Skip to content

Commit 5970def

Browse files
authored
Merge pull request #1232 from appwrite/fix-annotation
2 parents b66910c + d17a631 commit 5970def

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

templates/web/src/client.ts.twig

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,11 @@ class Client {
300300
/**
301301
* Holds configuration such as project.
302302
*/
303-
config = {
303+
config: {
304+
endpoint: string;
305+
endpointRealtime: string;
306+
[key: string]: string | undefined;
307+
} = {
304308
endpoint: '{{ spec.endpoint }}',
305309
endpointRealtime: '',
306310
{%~ for header in spec.global.headers %}
@@ -423,7 +427,9 @@ class Client {
423427
}
424428

425429
const channels = new URLSearchParams();
426-
channels.set('project', this.config.project);
430+
if (this.config.project) {
431+
channels.set('project', this.config.project);
432+
}
427433
this.realtime.channels.forEach(channel => {
428434
channels.append('channels[]', channel);
429435
});
@@ -478,7 +484,7 @@ class Client {
478484
this.realtime.lastMessage = message;
479485
switch (message.type) {
480486
case 'connected':
481-
let session = this.config?.session;
487+
let session = this.config.session;
482488
if (!session) {
483489
const cookie = JSON.parse(window.localStorage.getItem('cookieFallback') ?? '{}');
484490
session = cookie?.[`a_session_${this.config.project}`];

templates/web/src/services/realtime.ts.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ export class Realtime {
367367

368368
const messageData = message.data as RealtimeResponseConnected;
369369

370-
let session = this.client.config?.session;
370+
let session = this.client.config.session;
371371
if (!session) {
372372
try {
373373
const cookie = JSON.parse(window.localStorage.getItem('cookieFallback') ?? '{}');

0 commit comments

Comments
 (0)