切ts ing,js文件转ts后缀
This commit is contained in:
22
src/api/init.ts
Normal file
22
src/api/init.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import config from '../store/config'
|
||||
import status from '../store/status'
|
||||
|
||||
export default (params) => {
|
||||
Object.assign(config, params);
|
||||
// 如果配置更改了session的存储名字,则重新获取一次session
|
||||
if (params.sessionName) {
|
||||
try {
|
||||
status.session = wx.getStorageSync(config.sessionName) || '';
|
||||
} catch (e) {
|
||||
console.error('wx.getStorageSync:fail, can not get session.')
|
||||
}
|
||||
}
|
||||
// 如果配置更改了session过期时间的存储名字,则重新获取一次session的过期时间
|
||||
if (params.sessionExpireKey) {
|
||||
try {
|
||||
status.sessionExpire = wx.getStorageSync(config.sessionExpireKey) || Infinity;
|
||||
} catch (e) {
|
||||
console.error('wx.getStorageSync:fail, can not get sessionExpire.')
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user