2024-04-25 18:02:30 +08:00
|
|
|
"use strict";
|
|
|
|
const common_vendor = require("../common/vendor.js");
|
|
|
|
const useUserStore = common_vendor.defineStore("user", () => {
|
|
|
|
const userInfo = common_vendor.ref(common_vendor.index.getStorageSync("userInfo") || {});
|
2024-04-30 18:08:36 +08:00
|
|
|
const setUserInfo = (data) => {
|
|
|
|
userInfo.value = data;
|
|
|
|
common_vendor.index.setStorageSync("userInfo", data);
|
|
|
|
};
|
2024-04-25 18:02:30 +08:00
|
|
|
const token = common_vendor.ref(common_vendor.index.getStorageSync("token") || "");
|
|
|
|
const setToken = (data) => {
|
|
|
|
token.value = data;
|
|
|
|
common_vendor.index.setStorageSync("token", data);
|
|
|
|
};
|
2024-04-30 18:08:36 +08:00
|
|
|
return { userInfo, setUserInfo, token, setToken };
|
2024-04-25 18:02:30 +08:00
|
|
|
});
|
|
|
|
exports.useUserStore = useUserStore;
|