mirror of
https://github.com/logos-messaging/logos-messaging-frontend.git
synced 2026-01-02 13:53:13 +00:00
add fixes'
This commit is contained in:
parent
1923b3637e
commit
1370a6d0c4
@ -109,9 +109,12 @@ export class RLN implements IRLN {
|
||||
|
||||
private initKeystore(): Keystore {
|
||||
const localKeystoreString = localStorage.getItem("keystore");
|
||||
const _keystore = Keystore.fromString(localKeystoreString || "");
|
||||
|
||||
return _keystore || Keystore.create();
|
||||
|
||||
try {
|
||||
return Keystore.fromString(localKeystoreString || "");
|
||||
} catch(error) {
|
||||
return Keystore.create();
|
||||
}
|
||||
}
|
||||
|
||||
public addEventListener(name: RLNEventsNames, fn: EventListener) {
|
||||
|
||||
@ -53,7 +53,7 @@ class Relay {
|
||||
|
||||
this.subscriptionRoutine = window.setInterval(async () => {
|
||||
await this.fetchMessages();
|
||||
}, SECOND);
|
||||
}, 10 * SECOND);
|
||||
|
||||
this.contentTopicListeners.set(contentTopic, 1);
|
||||
} catch (error) {
|
||||
@ -83,8 +83,8 @@ class Relay {
|
||||
this.contentTopicListeners.delete(contentTopic);
|
||||
}
|
||||
|
||||
private async fetchMessages(): Promise<void> {
|
||||
const contentTopic = Object.keys(this.contentTopicListeners)[0];
|
||||
private async fetchMessages(): Promise<any> {
|
||||
const contentTopic = Array.from(this.contentTopicListeners.keys())[0];
|
||||
|
||||
if (!contentTopic) {
|
||||
return;
|
||||
|
||||
@ -5,9 +5,7 @@ export const http = {
|
||||
mode: "no-cors",
|
||||
referrerPolicy: "no-referrer",
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
body: JSON.stringify(body)
|
||||
});
|
||||
@ -18,14 +16,19 @@ export const http = {
|
||||
mode: "no-cors",
|
||||
referrerPolicy: "no-referrer",
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
body: JSON.stringify(body)
|
||||
});
|
||||
},
|
||||
get(url: string) {
|
||||
return fetch(new URL(url));
|
||||
return fetch(new URL(url), {
|
||||
method: "GET",
|
||||
mode: "no-cors",
|
||||
referrerPolicy: "no-referrer",
|
||||
headers: {
|
||||
'Content-Type': 'text/plain'
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user