mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-21 22:27:11 +00:00
Rejoin websocket rooms on reconnect. Fixes #41
This commit is contained in:
parent
3ff9b46981
commit
4f5d70d5b5
|
@ -417,6 +417,9 @@ export class Community extends Component<any, State> {
|
|||
this.context.router.history.push('/');
|
||||
return;
|
||||
} else if (msg.reconnect) {
|
||||
WebSocketService.Instance.communityJoin({
|
||||
community_id: this.state.communityRes.community.id,
|
||||
});
|
||||
this.fetchData();
|
||||
} else if (res.op == UserOperation.GetCommunity) {
|
||||
let data = res.data as GetCommunityResponse;
|
||||
|
|
|
@ -720,6 +720,7 @@ export class Main extends Component<any, MainState> {
|
|||
toast(i18n.t(msg.error), 'danger');
|
||||
return;
|
||||
} else if (msg.reconnect) {
|
||||
WebSocketService.Instance.communityJoin({ community_id: 0 });
|
||||
this.fetchData();
|
||||
} else if (res.op == UserOperation.GetFollowedCommunities) {
|
||||
let data = res.data as GetFollowedCommunitiesResponse;
|
||||
|
|
|
@ -392,6 +392,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
|
|||
}
|
||||
return;
|
||||
} else if (msg.reconnect) {
|
||||
WebSocketService.Instance.userJoin();
|
||||
this.fetchUnreads();
|
||||
} else if (res.op == UserOperation.GetReplies) {
|
||||
let data = res.data as GetRepliesResponse;
|
||||
|
|
|
@ -436,8 +436,10 @@ export class Post extends Component<any, PostState> {
|
|||
toast(i18n.t(msg.error), 'danger');
|
||||
return;
|
||||
} else if (msg.reconnect) {
|
||||
let postId = Number(this.props.match.params.id);
|
||||
WebSocketService.Instance.postJoin({ post_id: postId });
|
||||
WebSocketService.Instance.getPost({
|
||||
id: Number(this.props.match.params.id),
|
||||
id: postId,
|
||||
});
|
||||
} else if (res.op == UserOperation.GetPost) {
|
||||
let data = res.data as GetPostResponse;
|
||||
|
|
Loading…
Reference in a new issue