Skip to content

Commit

Permalink
Merge pull request #219 from ignaciano3/main
Browse files Browse the repository at this point in the history
feat: add path to redirectToHome
  • Loading branch information
awinogrodzki committed Jul 25, 2024
2 parents b4c8264 + ba018bb commit bda4597
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
7 changes: 0 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# [1.7.0-canary.1](https://github.com/awinogrodzki/next-firebase-auth-edge/compare/v1.6.2...v1.7.0-canary.1) (2024-07-25)


### Features

* introduced `refreshCookiesWithIdToken` function to enable login using Server Actions ([#212](https://github.com/awinogrodzki/next-firebase-auth-edge/issues/212)) ([6cd0b13](https://github.com/awinogrodzki/next-firebase-auth-edge/commit/6cd0b138036ff0f4fcfa91d786fca5255cfa2654))

# [1.7.0-canary.1](https://github.com/awinogrodzki/next-firebase-auth-edge/compare/v1.6.1...v1.7.0-canary.1) (2024-07-16)


Expand Down
13 changes: 11 additions & 2 deletions src/next/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ export interface CreateAuthMiddlewareOptions {
enableMultipleCookies?: boolean;
}

export function redirectToHome(request: NextRequest) {
interface RedirectToHomeOptions {
path: string;
}

export function redirectToHome(
request: NextRequest,
options: RedirectToHomeOptions = {
path: '/'
}
) {
const url = request.nextUrl.clone();
url.pathname = '/';
url.pathname = options.path;
url.search = '';
return NextResponse.redirect(url);
}
Expand Down

0 comments on commit bda4597

Please sign in to comment.