ansible/inventory
+ansible/inventory_dev
ansible/passwords/
docker/lemmy_mine.hjson
docker/dev/env_deploy.sh
toast(i18n.t(msg.error), 'danger');
this.context.router.history.push('/');
return;
+ } else if (msg.reconnect) {
+ this.fetchPosts();
} else if (res.op == UserOperation.GetCommunity) {
let data = res.data as GetCommunityResponse;
this.state.community = data.community;
if (msg.error) {
toast(i18n.t(msg.error), 'danger');
return;
+ } else if (msg.reconnect) {
+ this.refetch();
} else if (res.op == UserOperation.GetReplies) {
let data = res.data as GetRepliesResponse;
this.state.replies = data.replies;
if (msg.error) {
toast(i18n.t(msg.error), 'danger');
return;
+ } else if (msg.reconnect) {
+ this.fetchPosts();
} else if (res.op == UserOperation.GetFollowedCommunities) {
let data = res.data as GetFollowedCommunitiesResponse;
this.state.subscribedCommunities = data.communities;
location.reload();
}
return;
+ } else if (msg.reconnect) {
+ this.fetchUnreads();
} else if (res.op == UserOperation.GetReplies) {
let data = res.data as GetRepliesResponse;
let unreadReplies = data.replies.filter(r => !r.read);
if (msg.error) {
toast(i18n.t(msg.error), 'danger');
return;
+ } else if (msg.reconnect) {
+ WebSocketService.Instance.getPost({
+ id: Number(this.props.match.params.id),
+ });
} else if (res.op == UserOperation.GetPost) {
let data = res.data as GetPostResponse;
this.state.post = data.post;
}
this.setState(this.state);
return;
+ } else if (msg.reconnect) {
+ this.refetch();
} else if (res.op == UserOperation.GetUserDetails) {
let data = res.data as UserDetailsResponse;
this.state.user = data.user;
op?: string;
data?: ResponseType;
error?: string;
+ reconnect?: boolean;
}
GetPrivateMessagesForm,
UserJoinForm,
MessageType,
+ WebSocketJsonResponse,
} from '../interfaces';
import { UserService } from './';
import { i18n } from '../i18next';
private constructor() {
this.ws = new ReconnectingWebSocket(wsUri);
- this.ws.onopen = () => {
- console.log(`Connected to ${wsUri}`);
- if (UserService.Instance.user) {
- this.userJoin();
- }
- };
this.subject = Observable.create((obs: any) => {
this.ws.onmessage = e => {
obs.next(JSON.parse(e.data));
};
+ this.ws.onopen = () => {
+ console.log(`Connected to ${wsUri}`);
+ if (UserService.Instance.user) {
+ this.userJoin();
+ }
+ let res: WebSocketJsonResponse = {
+ reconnect: true,
+ };
+ obs.next(res);
+ };
}).pipe(share());
}