mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🐛 修复 ck 无法刷新问题
This commit is contained in:
@@ -12,11 +12,13 @@ import TPosition from "../components/t-position.vue";
|
|||||||
import TCalendar from "../components/t-calendar.vue";
|
import TCalendar from "../components/t-calendar.vue";
|
||||||
// store
|
// store
|
||||||
import { useHomeStore } from "../store/modules/home";
|
import { useHomeStore } from "../store/modules/home";
|
||||||
|
import { useUserStore } from "../store/modules/user";
|
||||||
// utils
|
// utils
|
||||||
import TGSqlite from "../utils/TGSqlite";
|
import TGSqlite from "../utils/TGSqlite";
|
||||||
|
|
||||||
// store
|
// store
|
||||||
const homeStore = useHomeStore();
|
const homeStore = useHomeStore();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
// loading
|
// loading
|
||||||
const loading = ref(true as boolean);
|
const loading = ref(true as boolean);
|
||||||
@@ -42,6 +44,8 @@ function readLoading (): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
const ck = await TGSqlite.getCookie();
|
||||||
|
userStore.initCookie(ck);
|
||||||
loadingTitle.value = "正在检测数据完整性";
|
loadingTitle.value = "正在检测数据完整性";
|
||||||
const isOK = await TGSqlite.check();
|
const isOK = await TGSqlite.check();
|
||||||
if (!isOK) {
|
if (!isOK) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const useUserStore = defineStore(
|
|||||||
return cookie.value[key] || "";
|
return cookie.value[key] || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initCookie (ck: Record<string, string>): Promise<void> {
|
function initCookie (ck: Record<string, string>): void {
|
||||||
if (cookie.value !== ck) {
|
if (cookie.value !== ck) {
|
||||||
cookie.value = ck;
|
cookie.value = ck;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user