17 lines
642 B
JavaScript
17 lines
642 B
JavaScript
"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") || {});
|
|
const setUserInfo = (data) => {
|
|
userInfo.value = data;
|
|
common_vendor.index.setStorageSync("userInfo", data);
|
|
};
|
|
const token = common_vendor.ref(common_vendor.index.getStorageSync("token") || "");
|
|
const setToken = (data) => {
|
|
token.value = data;
|
|
common_vendor.index.setStorageSync("token", data);
|
|
};
|
|
return { userInfo, setUserInfo, token, setToken };
|
|
});
|
|
exports.useUserStore = useUserStore;
|