feat: remove unused code
This commit is contained in:
		| @@ -7,17 +7,11 @@ export class Authentication { | ||||
|   isLoginLoading = false; | ||||
|   ctx; | ||||
|  | ||||
|   accessToken = ''; | ||||
|  | ||||
|   constructor(ctx) { | ||||
|     this.ctx = ctx; | ||||
|     makeAutoObservable(this); | ||||
|   } | ||||
|  | ||||
|   get isLoggedIn() { | ||||
|     return !!this.accessToken; | ||||
|   } | ||||
|  | ||||
|   get userData() { | ||||
|     const defaultValue = { | ||||
|       role: '', | ||||
| @@ -26,8 +20,7 @@ export class Authentication { | ||||
|     }; | ||||
|  | ||||
|     try { | ||||
|       console.log(JSON.parse(atob(this.accessToken.split('.')[1])), "isi jwt") | ||||
|       return JSON.parse(atob(this.accessToken.split('.')[1])); | ||||
|       return JSON.parse(atob(TokenUtil.accessToken.split('.')[1])); | ||||
|     } catch (err) { | ||||
|       return defaultValue; | ||||
|     } | ||||
| @@ -41,7 +34,6 @@ export class Authentication { | ||||
|     try { | ||||
|       const result = await http.post('/auth/login').send({username, password}); | ||||
|  | ||||
|       this.accessToken = result.body.access_token; | ||||
|       TokenUtil.setAccessToken(result.body.access_token); | ||||
|       TokenUtil.persistToken(); | ||||
|       runInAction(() => { | ||||
| @@ -61,6 +53,5 @@ export class Authentication { | ||||
|     TokenUtil.clearAccessToken(); | ||||
|     TokenUtil.persistToken(); | ||||
|     this.isLoggedIn = false; | ||||
|     this.accessToken = ''; | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -18,7 +18,6 @@ export class Store { | ||||
|         TokenUtil.loadToken(); | ||||
|         if (TokenUtil.accessToken) { | ||||
|             this.authentication.isLoggedIn = true; | ||||
|             this.authentication.accessToken = TokenUtil.accessToken; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user