This commit is contained in:
AceDataCloud committed 2023-09-25 20:54:31 +08:00
1 parent d206c7df38
commit affd47193c
14 files changed
+73 -160

No files matched your search

+1 -21
View File
@@ -8,7 +8,6 @@
import { defineComponent } from 'vue';
import { ElConfigProvider } from 'element-plus';
import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
import { authOperator } from './operators/auth/operator';
export default defineComponent({
components: {
@@ -19,25 +18,6 @@ export default defineComponent({
locale: zhCn
};
},
async mounted() {
// if refresh token is already set, try to refresh it and get user info
const currentRefreshToken = this.$store.getters.refreshToken;
const currentAccessToken = this.$store.getters.accessToken;
if (!currentAccessToken) {
console.log('user not login');
}
if (currentRefreshToken) {
const {
data: { access: accessToken, refresh: refreshToken }
} = await authOperator.refreshToken({
refresh: currentRefreshToken
});
await this.$store.dispatch('setAccessToken', accessToken);
await this.$store.dispatch('setRefreshToken', refreshToken);
await this.$store.dispatch('getMe');
} else {
console.error('refresh token does not exist');
}
}
async mounted() {}
});
</script>