Charge coin

This commit is contained in:
saplf
2019-09-03 21:05:19 +08:00
parent 1dc9a95835
commit da6d2c0e68
11 changed files with 388 additions and 23 deletions

View File

@@ -2,6 +2,7 @@
const userKey = 'user-key';
const areaCodeKey = 'area-code-key';
const mineListKey = 'mine-list-key';
const coinsKey = 'coin-key';
// user info from now on
function storeUser(user: any = undefined) {
@@ -54,6 +55,23 @@ function clearMineList() {
localStorage.removeItem(mineListKey);
}
// coin list info from now on
function storeCoins(coins: any) {
localStorage.setItem(coinsKey, JSON.stringify(coins));
}
function loadCoins() {
try {
return JSON.parse(localStorage.getItem(coinsKey) || 'null');
} catch (e) {
return null;
}
}
function clearCoins() {
localStorage.removeItem(coinsKey);
}
export {
storeUser,
loadUser,
@@ -65,4 +83,8 @@ export {
storeMineList,
loadMineList,
clearMineList,
storeCoins,
loadCoins,
clearCoins,
}