mirror of
https://github.com/YMFE/yapi.git
synced 2025-04-18 15:20:25 +08:00
Merge branch 'master' of https://github.com/YMFE/yapi
This commit is contained in:
commit
0a6193c2ae
@ -12,16 +12,17 @@ module.exports = function storageCreator(id) {
|
||||
},
|
||||
setItem: async (name, value) => {
|
||||
let inst = yapi.getInst(storageModel);
|
||||
let data = await inst.get(id) || defaultData;
|
||||
let curData = await inst.get(id);
|
||||
let data = curData || defaultData;
|
||||
let result;
|
||||
data[name] = value;
|
||||
if(!data){
|
||||
if(!curData){
|
||||
result = await inst.save(id, data, true)
|
||||
}else{
|
||||
result = await inst.save(id, data, false)
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user