fix #216 with cookie mgmt.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { defineStore } from "pinia";
|
||||
import axios from 'axios';
|
||||
import apiError from '@/module/apiError.js';
|
||||
import { deleteCookie, setCookie } from "../utils/cookieUtil";
|
||||
|
||||
export default defineStore('loginStore', {
|
||||
// data, methods, computed
|
||||
@@ -40,6 +41,7 @@ export default defineStore('loginStore', {
|
||||
// document.cookie = `luciaRefreshToken=${refreshToken};expires=${new Date(this.expired)};`;
|
||||
|
||||
this.isLoggedIn = true;
|
||||
setCookie("isLuciaLoggedIn", "true");
|
||||
|
||||
// 大部分的情況下,預設導向至 FILES 頁面
|
||||
// 然而有一種情況是使用者在沒有登入的情況下貼上了某一個頁面的網址,
|
||||
@@ -85,6 +87,7 @@ export default defineStore('loginStore', {
|
||||
document.cookie = 'luciaToken=; expires=Thu, 01 Jan 1970 00:00:00 UTC;';
|
||||
|
||||
this.isLoggedIn = false;
|
||||
deleteCookie("isLuciaLoggedIn");
|
||||
|
||||
this.$router.push('/login');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user