Login & Register
This commit is contained in:
@@ -14,6 +14,11 @@ export async function getAreaCodes(): Promise<AreaCodes> {
|
||||
|
||||
const res = await http.get<AreaCodes>('/sign/code');
|
||||
if (res.ok && res.data) {
|
||||
res.data = res.data.map((it: any) => ({
|
||||
id: it.id || it.pode,
|
||||
areacode: it.areacode || it.itc.match(/\d+/)[0],
|
||||
areaname: it.areaname || it.name_native || it.name_en,
|
||||
}));
|
||||
storeAreaCode(res.data);
|
||||
return res.data;
|
||||
}
|
||||
@@ -24,7 +29,7 @@ export async function getAreaCodes(): Promise<AreaCodes> {
|
||||
export async function getUserInfo(refresh = false): Promise<User> {
|
||||
if (!refresh) {
|
||||
const userCache = loadUser() as User;
|
||||
if (userCache) {
|
||||
if (userCache && userCache.id) {
|
||||
return userCache;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user