purchase-let/unpackage/dist/dev/mp-weixin/store/user.js

20 lines
780 B
JavaScript
Raw Normal View History

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-28 18:08:57 +08:00
userInfo.value = {
"nickname": "哈哈",
"mobile": "17685151643",
"avatar": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/avatar.png",
"token": "a8670fe7f1014c0f5125f6ca0c3b9cb3"
};
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-28 18:08:57 +08:00
token.value = "a8670fe7f1014c0f5125f6ca0c3b9cb3";
2024-04-25 18:02:30 +08:00
return { userInfo, setToken, token, setToken };
});
exports.useUserStore = useUserStore;