增加新模块
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
const TOKEN_NAME = "fcc-token";
|
||||
const USER_KEY = "fcc-user-key";
|
||||
const USER_DATA = "fcc-user-data";
|
||||
const USER_LOGIN_TIME = "fcc-login-time";
|
||||
function setStorageFun(key, value, sync = true) {
|
||||
try {
|
||||
if (sync) {
|
||||
return common_vendor.index.setStorageSync(key, value);
|
||||
} else {
|
||||
common_vendor.index.setStorage({
|
||||
key,
|
||||
data: value
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
function getStorageFun(key, sync = true) {
|
||||
try {
|
||||
if (sync) {
|
||||
return common_vendor.index.getStorageSync(key);
|
||||
} else {
|
||||
let data = "";
|
||||
common_vendor.index.getStorage({
|
||||
key,
|
||||
success: function(res) {
|
||||
data = res.data;
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.TOKEN_NAME = TOKEN_NAME;
|
||||
exports.USER_DATA = USER_DATA;
|
||||
exports.USER_KEY = USER_KEY;
|
||||
exports.USER_LOGIN_TIME = USER_LOGIN_TIME;
|
||||
exports.getStorageFun = getStorageFun;
|
||||
exports.setStorageFun = setStorageFun;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/auth.js.map
|
||||
Reference in New Issue
Block a user