feat: remove unused code

This commit is contained in:
caturbgs 2021-12-09 23:29:40 +07:00
parent 7a62ad32a9
commit 993c24cd36
4 changed files with 12 additions and 23 deletions

View File

@ -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")
}}
/>
<div

View File

@ -98,7 +98,8 @@ export const Product = observer(() => {
Prdct
</TabPane>
</Tabs>
</Card><PulsaModal visible={visibleModal}
</Card>
<PulsaModal visible={visibleModal}
confirmLoading={confirmLoading}
initialData={initialData}
onCreate={async (data) => {

View File

@ -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 = '';
}
}

View File

@ -18,7 +18,6 @@ export class Store {
TokenUtil.loadToken();
if (TokenUtil.accessToken) {
this.authentication.isLoggedIn = true;
this.authentication.accessToken = TokenUtil.accessToken;
}
}
}