Compare commits
No commits in common. "b8d08b40bbadb119d18766a7f9fc27dd452e4d33" and "5044db830b35aeb7424c0f3081dcf78e6c314d8e" have entirely different histories.
b8d08b40bb
...
5044db830b
@ -55,16 +55,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { ApiError } from 'src/boot/axios';
|
import { ApiError } from 'src/boot/axios';
|
||||||
import { getUserInfo, login } from 'src/api/UserApi';
|
import { login } from 'src/api/UserApi';
|
||||||
import { clearJwtToken, saveJwtToken } from 'src/configs/TokenManage';
|
import { clearJwtToken, saveJwtToken } from 'src/configs/TokenManage';
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useUserStore } from 'src/stores/user-store';
|
|
||||||
import { handleRefreshToken } from 'src/utils/refreshToken';
|
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const userStore = useUserStore();
|
|
||||||
|
|
||||||
const loginInfo = reactive({
|
const loginInfo = reactive({
|
||||||
account: '',
|
account: '',
|
||||||
@ -77,14 +74,6 @@ async function doLogin() {
|
|||||||
clearJwtToken();
|
clearJwtToken();
|
||||||
const token = await login(loginInfo);
|
const token = await login(loginInfo);
|
||||||
saveJwtToken(token);
|
saveJwtToken(token);
|
||||||
const userInfo = await getUserInfo();
|
|
||||||
userStore.roles = userInfo.roles;
|
|
||||||
userStore.defaultRole = userInfo.defaultRole;
|
|
||||||
userStore.remainingSecond = userInfo.remainingSecond;
|
|
||||||
setTimeout(
|
|
||||||
() => handleRefreshToken(),
|
|
||||||
userInfo.remainingSecond * 1000 - 10000
|
|
||||||
);
|
|
||||||
router.push({ name: 'home' });
|
router.push({ name: 'home' });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user