Skip to content

Commit

Permalink
Remove hardcoding from the page-level locale
Browse files Browse the repository at this point in the history
Refs #2044
  • Loading branch information
thewilkybarkid committed Oct 25, 2024
1 parent e1d97b9 commit a77936a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const LogInResponse = (args: Omit<LogInResponse, '_tag'>): LogInResponse
export function handleResponse(response: {
response: Response
user?: User
locale?: SupportedLocale
}): RM.ReaderMiddleware<
GetUserOnboardingEnv & OrcidOAuthEnv & PublicUrlEnv & TemplatePageEnv,
StatusOpen,
Expand Down Expand Up @@ -221,9 +222,11 @@ export const toPage = ({
export const handlePageResponse = ({
response,
user,
locale = DefaultLocale,
}: {
response: PageResponse | StreamlinePageResponse
user?: User
locale?: SupportedLocale
}): RM.ReaderMiddleware<
GetUserOnboardingEnv & PublicUrlEnv & TemplatePageEnv,
StatusOpen,
Expand All @@ -233,7 +236,7 @@ export const handlePageResponse = ({
> =>
pipe(
RM.of({}),
RM.apS('locale', RM.of(DefaultLocale)),
RM.apS('locale', RM.of(locale)),
RM.apS('message', RM.fromMiddleware(getFlashMessage(FlashMessageD))),
RM.apS('userOnboarding', user ? RM.fromReaderTaskEither(maybeGetUserOnboarding(user.orcid)) : RM.of(undefined)),
RM.apSW(
Expand Down Expand Up @@ -289,9 +292,11 @@ export const handlePageResponse = ({
const handleTwoUpPageResponse = ({
response,
user,
locale = DefaultLocale,
}: {
response: TwoUpPageResponse
user?: User
locale?: SupportedLocale
}): RM.ReaderMiddleware<
GetUserOnboardingEnv & PublicUrlEnv & TemplatePageEnv,
StatusOpen,
Expand All @@ -301,7 +306,7 @@ const handleTwoUpPageResponse = ({
> =>
pipe(
RM.of({}),
RM.apS('locale', RM.of(DefaultLocale)),
RM.apS('locale', RM.of(locale)),
RM.apS('message', RM.fromMiddleware(getFlashMessage(FlashMessageD))),
RM.apS('userOnboarding', user ? RM.fromReaderTaskEither(maybeGetUserOnboarding(user.orcid)) : RM.of(undefined)),
RM.apSW(
Expand Down

0 comments on commit a77936a

Please sign in to comment.