tiefen_space_h5/utils/storeInfo.js

29 lines
701 B
JavaScript

export function save(key,value){
localStorage.setItem(key,value)
}
export function get(key){
let data = localStorage.getItem(key);
// console.log(key,data)
return data ? JSON.parse(data) : {};
}
export function remove(key){
localStorage.removeItem(key)
}
export function clear(){
localStorage.clear()
}
export function saveUserInfo (data, mobilePhone, regionCode){
save("token", data.data.token);
save("account", JSON.stringify(data.data.account));
save("mobile_phone", mobilePhone);
save("region_code", regionCode);
}
export function removeUserInfo (){
remove("token");
remove("account");
remove("mobile_phone");
remove("region_code");
}