Skip to content

Commit

Permalink
fixes nextjs ssr docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed Jul 29, 2024
1 parent e869528 commit f245224
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 100 deletions.
10 changes: 2 additions & 8 deletions v2/emailpassword/nextjs/app-directory/protecting-route.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -440,10 +437,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -225,10 +222,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
5 changes: 1 addition & 4 deletions v2/emailpassword/nextjs/session-verification/in-ssr.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ async function getSSRSessionHelper(context: GetServerSidePropsContext): Promise<
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
10 changes: 2 additions & 8 deletions v2/passwordless/nextjs/app-directory/protecting-route.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -440,10 +437,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -225,10 +222,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
5 changes: 1 addition & 4 deletions v2/passwordless/nextjs/session-verification/in-ssr.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ async function getSSRSessionHelper(context: GetServerSidePropsContext): Promise<
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
10 changes: 2 additions & 8 deletions v2/thirdparty/nextjs/app-directory/protecting-route.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -440,10 +437,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -225,10 +222,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
5 changes: 1 addition & 4 deletions v2/thirdparty/nextjs/session-verification/in-ssr.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ async function getSSRSessionHelper(context: GetServerSidePropsContext): Promise<
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -441,10 +438,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -226,10 +223,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ async function getSSRSessionHelper(context: GetServerSidePropsContext): Promise<
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -440,10 +437,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down Expand Up @@ -225,10 +222,7 @@ async function getSSRSessionHelper(): Promise<{
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ async function getSSRSessionHelper(context: GetServerSidePropsContext): Promise<
}
return { accessTokenPayload: undefined, hasToken, error: undefined };
} catch (error) {
if (error instanceof JsonWebToken.TokenExpiredError) {
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
return { accessTokenPayload: undefined, hasToken, error: error as Error };
return { accessTokenPayload: undefined, hasToken, error: undefined };
}
}

Expand Down

0 comments on commit f245224

Please sign in to comment.