Charge coin
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user