Merge pull request #2687 from urbit/la-resub-on-err

chat-js: resubscribe on error, not just on quit
This commit is contained in:
ixv 2020-04-09 15:52:03 -07:00 committed by GitHub
commit 5fe16a7f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,10 @@ export class Subscription {
subscribe(path, app) {
api.bind(path, 'PUT', api.authTokens.ship, app,
this.handleEvent.bind(this),
this.handleError.bind(this),
(err) => {
console.log(err);
this.subscribe(path, app);
},
() => {
this.subscribe(path, app);
});
@ -48,10 +51,6 @@ export class Subscription {
store.handleEvent(diff);
}
handleError(err) {
console.error(err);
}
fetchMessages(start, end, path) {
console.log(start, end, path);
fetch(`/~chat/paginate/${start}/${end}${path}`)