You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
680 B
17 lines
680 B
import getDefaultAuth from "./state";
|
|
|
|
export function updateAuth({ commit }, auth) {
|
|
auth = auth ?? getDefaultAuth();
|
|
if ("token" in auth) uni.setStorageSync("auth-token", auth.token);
|
|
if ("id" in auth) commit("SET_AUTH_ID", auth.id);
|
|
if ("account" in auth) commit("SET_AUTH_ACCOUNT", auth.account);
|
|
if ("name" in auth) commit("SET_AUTH_NAME", auth.name);
|
|
if ("idCardNo" in auth) commit("SET_AUTH_ID_CARD_NO", auth.idCardNo);
|
|
if ("mobileNo" in auth) commit("SET_AUTH_MOBILE_NO", auth.mobileNo);
|
|
if ("bankCardNo" in auth) commit("SET_AUTH_BANK_CARD_NO", auth.bankCardNo);
|
|
}
|
|
|
|
export function revertAuth({ dispatch }) {
|
|
dispatch("updateAuth", getDefaultAuth());
|
|
}
|