Actually sending ws requests, some other fixes.
This commit is contained in:
parent
7ae444d209
commit
368d4199a5
32 changed files with 362 additions and 250 deletions
|
@ -3,8 +3,6 @@ import IsomorphicCookie from 'isomorphic-cookie';
|
|||
import { User_, LoginResponse } from 'lemmy-js-client';
|
||||
import jwt_decode from 'jwt-decode';
|
||||
import { Subject, BehaviorSubject } from 'rxjs';
|
||||
import { i18n } from '../i18next';
|
||||
import { toast } from '../utils';
|
||||
|
||||
interface Claims {
|
||||
id: number;
|
||||
|
@ -50,15 +48,6 @@ export class UserService {
|
|||
return IsomorphicCookie.load('jwt');
|
||||
}
|
||||
|
||||
public authField(throwErr: boolean = true): string {
|
||||
if (this.auth == null && throwErr) {
|
||||
toast(i18n.t('not_logged_in'), 'danger');
|
||||
throw 'Not logged in';
|
||||
} else {
|
||||
return this.auth;
|
||||
}
|
||||
}
|
||||
|
||||
private setClaims(jwt: string) {
|
||||
this.claims = jwt_decode(jwt);
|
||||
this.jwtSub.next(jwt);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue