bugfix - token过期导致的登录异常
This commit is contained in:
parent
fe8fc9cf33
commit
916d89abf7
@ -7,3 +7,7 @@ export function saveJwtToken(token: string) {
|
||||
export function getJwtToken(): string | null {
|
||||
return sessionStorage.getItem(JwtTokenKey);
|
||||
}
|
||||
|
||||
export function clearJwtToken(): void {
|
||||
sessionStorage.removeItem(JwtTokenKey);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
function getHost(): string {
|
||||
// return '192.168.3.7:9081';
|
||||
// return '192.168.3.47:9081';
|
||||
return '192.168.3.233:9081';
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
import { useQuasar } from 'quasar';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
import { login } from 'src/api/UserApi';
|
||||
import { saveJwtToken } from 'src/configs/TokenManage';
|
||||
import { clearJwtToken, saveJwtToken } from 'src/configs/TokenManage';
|
||||
import { reactive } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
@ -69,6 +69,7 @@ const loginInfo = reactive({
|
||||
|
||||
async function doLogin() {
|
||||
try {
|
||||
clearJwtToken();
|
||||
const token = await login(loginInfo);
|
||||
saveJwtToken(token);
|
||||
router.push({ name: 'home' });
|
||||
|
Loading…
Reference in New Issue
Block a user