From 993c24cd3699d9a6210779c588421bf59357a987 Mon Sep 17 00:00:00 2001 From: caturbgs Date: Thu, 9 Dec 2021 23:29:40 +0700 Subject: [PATCH] feat: remove unused code --- src/pages/App/DesktopLayout.js | 2 -- src/pages/Product/Product.js | 21 +++++++++++---------- src/store/authentication.js | 11 +---------- src/store/index.js | 1 - 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/pages/App/DesktopLayout.js b/src/pages/App/DesktopLayout.js index 6a474fc..1c46dc5 100644 --- a/src/pages/App/DesktopLayout.js +++ b/src/pages/App/DesktopLayout.js @@ -88,7 +88,6 @@ export const DesktopLayout = observer(() => { width={"50%"} onClose={() => { store.ui.toggleLeftDrawerIsShown() - console.log("clicked"); }} visible={store.ui.leftDrawerIsShown} key={"dashboard-drawer"} @@ -211,7 +210,6 @@ export const DesktopLayout = observer(() => { } onClick={() => { store.ui.toggleLeftDrawerIsShown(); - console.log("apa") }} />
{ Prdct - { - onSubmit(data) - }} - onCancel={() => { - setInitialData({}) - setVisibleModal(false); - }}/> + + { + onSubmit(data) + }} + onCancel={() => { + setInitialData({}) + setVisibleModal(false); + }}/>
); }); diff --git a/src/store/authentication.js b/src/store/authentication.js index 2b46fe9..4b90963 100644 --- a/src/store/authentication.js +++ b/src/store/authentication.js @@ -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 = ''; } } diff --git a/src/store/index.js b/src/store/index.js index 3d345dd..cb89030 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -18,7 +18,6 @@ export class Store { TokenUtil.loadToken(); if (TokenUtil.accessToken) { this.authentication.isLoggedIn = true; - this.authentication.accessToken = TokenUtil.accessToken; } } }