Compare commits
4 Commits
4b669a7b5d
...
45e4478506
| Author | SHA1 | Date |
|---|---|---|
|
|
45e4478506 | |
|
|
354c3f48ae | |
|
|
761e60bf8c | |
|
|
aad4694c44 |
2
.env
2
.env
|
|
@ -22,4 +22,4 @@
|
||||||
|
|
||||||
# Local Dev
|
# Local Dev
|
||||||
EXPO_PUBLIC_API_URL=http://localhost:8000/api
|
EXPO_PUBLIC_API_URL=http://localhost:8000/api
|
||||||
EXPO_PUBLIC_STOREFRONT_URL=http://localhost:3000
|
EXPO_PUBLIC_STOREFRONT_URL=http://localhost:3000
|
||||||
|
|
|
||||||
6
app.json
6
app.json
|
|
@ -18,7 +18,9 @@
|
||||||
"monochromeImage": "./assets/images/android-icon-monochrome.png"
|
"monochromeImage": "./assets/images/android-icon-monochrome.png"
|
||||||
},
|
},
|
||||||
"predictiveBackGestureEnabled": false,
|
"predictiveBackGestureEnabled": false,
|
||||||
"package": "com.anonymous.acupedia"
|
"package": "com.anonymous.acupedia",
|
||||||
|
"usesCleartextTraffic": true,
|
||||||
|
"allowBackup": false
|
||||||
},
|
},
|
||||||
"web": {
|
"web": {
|
||||||
"output": "static",
|
"output": "static",
|
||||||
|
|
@ -40,4 +42,4 @@
|
||||||
"reactCompiler": true
|
"reactCompiler": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
export function asString(value: unknown): string {
|
export function asString(value: unknown): string {
|
||||||
return typeof value === "string" ? value : "";
|
if (typeof value === "string") return value;
|
||||||
|
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
||||||
|
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
||||||
|
const record = value as Record<string, unknown>;
|
||||||
|
for (const key of ["label", "point_name", "name", "title", "code"]) {
|
||||||
|
if (typeof record[key] === "string" && (record[key] as string).trim().length > 0) {
|
||||||
|
return (record[key] as string).trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function asNumber(value: unknown): number | null {
|
export function asNumber(value: unknown): number | null {
|
||||||
|
|
@ -7,9 +17,10 @@ export function asNumber(value: unknown): number | null {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function asStringArray(value: unknown): string[] {
|
export function asStringArray(value: unknown): string[] {
|
||||||
return Array.isArray(value)
|
if (!Array.isArray(value)) return [];
|
||||||
? value.filter((item): item is string => typeof item === "string" && item.trim().length > 0)
|
return value
|
||||||
: [];
|
.map((item) => asString(item).trim())
|
||||||
|
.filter((item) => item.length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function asRecord(value: unknown): Record<string, unknown> {
|
export function asRecord(value: unknown): Record<string, unknown> {
|
||||||
|
|
|
||||||
|
|
@ -269,6 +269,9 @@ export const useAuthStore = create<AuthStore>()(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setApiAccessToken(state?.accessToken ?? null);
|
setApiAccessToken(state?.accessToken ?? null);
|
||||||
|
if (state?.accessToken && state?.isAuthenticated) {
|
||||||
|
void useAuthStore.getState().refreshSession();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue