Skip to content

Commit

Permalink
fix getLocale type error if query is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelSiidorow committed Jan 31, 2024
1 parent c8beef0 commit dcb7d44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/cms/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const useGoogleAuth = (): boolean => {
};
export function getLocale(req: PayloadRequest): string | undefined {
const res =
typeof req.query.locale === "string" ? req.query.locale : req.locale;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- query may be undefined, payload types are scuffed
typeof req.query?.locale === "string" ? req.query.locale : req.locale;
if (!res) {
req.payload.logger.warn(`locale not set for ${req.path}, defaulting to fi`);
}
Expand Down

0 comments on commit dcb7d44

Please sign in to comment.