feat: remove unused code
This commit is contained in:
parent
7a62ad32a9
commit
993c24cd36
|
@ -88,7 +88,6 @@ export const DesktopLayout = observer(() => {
|
||||||
width={"50%"}
|
width={"50%"}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
store.ui.toggleLeftDrawerIsShown()
|
store.ui.toggleLeftDrawerIsShown()
|
||||||
console.log("clicked");
|
|
||||||
}}
|
}}
|
||||||
visible={store.ui.leftDrawerIsShown}
|
visible={store.ui.leftDrawerIsShown}
|
||||||
key={"dashboard-drawer"}
|
key={"dashboard-drawer"}
|
||||||
|
@ -211,7 +210,6 @@ export const DesktopLayout = observer(() => {
|
||||||
}
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
store.ui.toggleLeftDrawerIsShown();
|
store.ui.toggleLeftDrawerIsShown();
|
||||||
console.log("apa")
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -98,16 +98,17 @@ export const Product = observer(() => {
|
||||||
Prdct
|
Prdct
|
||||||
</TabPane>
|
</TabPane>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Card><PulsaModal visible={visibleModal}
|
</Card>
|
||||||
confirmLoading={confirmLoading}
|
<PulsaModal visible={visibleModal}
|
||||||
initialData={initialData}
|
confirmLoading={confirmLoading}
|
||||||
onCreate={async (data) => {
|
initialData={initialData}
|
||||||
onSubmit(data)
|
onCreate={async (data) => {
|
||||||
}}
|
onSubmit(data)
|
||||||
onCancel={() => {
|
}}
|
||||||
setInitialData({})
|
onCancel={() => {
|
||||||
setVisibleModal(false);
|
setInitialData({})
|
||||||
}}/>
|
setVisibleModal(false);
|
||||||
|
}}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,17 +7,11 @@ export class Authentication {
|
||||||
isLoginLoading = false;
|
isLoginLoading = false;
|
||||||
ctx;
|
ctx;
|
||||||
|
|
||||||
accessToken = '';
|
|
||||||
|
|
||||||
constructor(ctx) {
|
constructor(ctx) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
makeAutoObservable(this);
|
makeAutoObservable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
get isLoggedIn() {
|
|
||||||
return !!this.accessToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
get userData() {
|
get userData() {
|
||||||
const defaultValue = {
|
const defaultValue = {
|
||||||
role: '',
|
role: '',
|
||||||
|
@ -26,8 +20,7 @@ export class Authentication {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log(JSON.parse(atob(this.accessToken.split('.')[1])), "isi jwt")
|
return JSON.parse(atob(TokenUtil.accessToken.split('.')[1]));
|
||||||
return JSON.parse(atob(this.accessToken.split('.')[1]));
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +34,6 @@ export class Authentication {
|
||||||
try {
|
try {
|
||||||
const result = await http.post('/auth/login').send({username, password});
|
const result = await http.post('/auth/login').send({username, password});
|
||||||
|
|
||||||
this.accessToken = result.body.access_token;
|
|
||||||
TokenUtil.setAccessToken(result.body.access_token);
|
TokenUtil.setAccessToken(result.body.access_token);
|
||||||
TokenUtil.persistToken();
|
TokenUtil.persistToken();
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
|
@ -61,6 +53,5 @@ export class Authentication {
|
||||||
TokenUtil.clearAccessToken();
|
TokenUtil.clearAccessToken();
|
||||||
TokenUtil.persistToken();
|
TokenUtil.persistToken();
|
||||||
this.isLoggedIn = false;
|
this.isLoggedIn = false;
|
||||||
this.accessToken = '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ export class Store {
|
||||||
TokenUtil.loadToken();
|
TokenUtil.loadToken();
|
||||||
if (TokenUtil.accessToken) {
|
if (TokenUtil.accessToken) {
|
||||||
this.authentication.isLoggedIn = true;
|
this.authentication.isLoggedIn = true;
|
||||||
this.authentication.accessToken = TokenUtil.accessToken;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user