diff --git a/src/pages/App/DesktopLayout.js b/src/pages/App/DesktopLayout.js index abf523d..6a474fc 100644 --- a/src/pages/App/DesktopLayout.js +++ b/src/pages/App/DesktopLayout.js @@ -279,9 +279,9 @@ export const DesktopLayout = observer(() => { } title={ - {store.user.data.email}{" "} + {store.user.data.username} - {store.authentication.userData.email} + {store.authentication.userData.username} } @@ -353,12 +353,13 @@ export const DesktopLayout = observer(() => { }} mode="inline" > - + Profile { store.authentication.logout(); history.push("/login"); @@ -372,7 +373,7 @@ export const DesktopLayout = observer(() => { {store.user.data.email}{" "} - {/*{store.authentication.userData.full_name}*/} + {store.authentication.userData.username} } diff --git a/src/store/authentication.js b/src/store/authentication.js index 24f2b35..2b46fe9 100644 --- a/src/store/authentication.js +++ b/src/store/authentication.js @@ -41,6 +41,7 @@ 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(() => { @@ -60,5 +61,6 @@ 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 cb89030..3d345dd 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -18,6 +18,7 @@ export class Store { TokenUtil.loadToken(); if (TokenUtil.accessToken) { this.authentication.isLoggedIn = true; + this.authentication.accessToken = TokenUtil.accessToken; } } } diff --git a/src/store/product.js b/src/store/product.js index cd761ae..9b52295 100644 --- a/src/store/product.js +++ b/src/store/product.js @@ -15,8 +15,6 @@ export class Product { @action async getData() { const response = await http.get(`/product?page=${this.page}&pageSize=${this.pageSize}`); - console.log(response, 'Data') - console.log(JSON.stringify(response.body.data), 'Data') this.data = response.body.data ?? [] this.total_data = response.body.total_data ?? 0