Skip to content

Commit

Permalink
Simpler function
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Depalo <matteo@depalo.me>
  • Loading branch information
matteodepalo committed Jul 12, 2020
1 parent 23c08dc commit 4dc5605
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/url-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@ export function recipeShareUrl(token: string) {
}

export default function createLoginUrl(locale: string, redirectTo?: string) {
if (redirectTo) {
return `/api/login?redirectTo=${encodeURIComponent(redirectTo)}&ui_locales=${locale}`;
}
return `/api/login?redirectTo=${encodeURIComponent('/recipes')}&ui_locales=${locale}`;
return `/api/login?redirectTo=${encodeURIComponent(redirectTo ?? '/recipes')}&ui_locales=${locale}`;
}

0 comments on commit 4dc5605

Please sign in to comment.