fix(api): satisfy typecheck for focusFactValue
Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
This commit is contained in:
parent
5387b38e54
commit
3a3e0b3e27
@ -69,7 +69,8 @@ const FOCUS_FACTS: Record<string, Record<FocusOption["id"], string>> = {
|
|||||||
export function focusFactValue(focusId: string, locale: string): string {
|
export function focusFactValue(focusId: string, locale: string): string {
|
||||||
const id = focusId as FocusOption["id"];
|
const id = focusId as FocusOption["id"];
|
||||||
const key = locale.toLowerCase().startsWith("de") ? "de" : "en";
|
const key = locale.toLowerCase().startsWith("de") ? "de" : "en";
|
||||||
return FOCUS_FACTS[key][id] ?? FOCUS_FACTS.en[id];
|
const table = FOCUS_FACTS[key];
|
||||||
|
return table[id] ?? FOCUS_FACTS.en[id] ?? focusId;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FOCUS_OPTIONS: FocusOption[] = [
|
export const FOCUS_OPTIONS: FocusOption[] = [
|
||||||
@ -135,7 +136,7 @@ export const INTAKE_STEPS: IntakeStep[] = [
|
|||||||
if (!option) return;
|
if (!option) return;
|
||||||
const profile = await tx.userProfile.findUnique({
|
const profile = await tx.userProfile.findUnique({
|
||||||
where: { userId },
|
where: { userId },
|
||||||
select: { locale: true, language: true },
|
select: { locale: true, timeZone: true },
|
||||||
});
|
});
|
||||||
const locale = intakeContext(profile, new Date()).locale;
|
const locale = intakeContext(profile, new Date()).locale;
|
||||||
await tx.userOnboarding.update({ where: { userId }, data: { focus: option.id } });
|
await tx.userOnboarding.update({ where: { userId }, data: { focus: option.id } });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user