♻️ userStore 及 cookie 相关类型重构 #51

This commit is contained in:
BTMuli
2023-12-16 22:07:31 +08:00
parent 00386bc7ee
commit 4370bbaa57
16 changed files with 267 additions and 236 deletions

View File

@@ -21,7 +21,6 @@ import QrcodeVue from "qrcode.vue";
import { computed, reactive, ref, watch } from "vue";
import Mys from "../../plugins/Mys";
import TGSqlite from "../../plugins/Sqlite";
import { useUserStore } from "../../store/modules/user";
import TGRequest from "../../web/request/TGRequest";
import showSnackbar from "../func/snackbar";
@@ -48,7 +47,7 @@ const visible = computed({
const loading = ref<boolean>(false);
const qrCode = ref<string>("");
const ticket = ref<string>("");
const cookie = reactive<Record<string, string>>({
const cookie = reactive<TGApp.User.Account.Cookie>({
account_id: "",
ltuid: "",
stuid: "",
@@ -142,8 +141,7 @@ async function getTokens(): Promise<void> {
if (typeof cookieTokenRes === "string") cookie.cookie_token = cookieTokenRes;
const ltokenRes = await TGRequest.User.bySToken.getLToken(cookie.mid, cookie.stoken);
if (typeof ltokenRes === "string") cookie.ltoken = ltokenRes;
userStore.cookie = cookie;
await TGSqlite.saveAppData("cookie", JSON.stringify(cookie));
await userStore.saveCookie(cookie);
}
</script>
<style lang="css" scoped>