docs: fix incorrect .js extension with .ts extension (#19925)

* docs: fix incorrect .js extension with .ts extension

Within the SvelteKit example, the guide incorrectly references creating a .js file as opposed to a .ts as is required, given the contents of said file has Typescript within it

* Update apps/docs/pages/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr.mdx

* run formatter

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
Co-authored-by: dshukertjr <dshukertjr@gmail.com>
This commit is contained in:
authored and GitHub committed 2024-02-20 23:44:35 +00:00
1 parent 15887ee164
commit 200740b016
1 file changed
+14 -14
@@ -75,30 +75,30 @@ export async function GET(request: NextRequest) {
</TabPanel>
<TabPanel id="sveltekit" label="SvelteKit">
Create a new file at `src/routes/auth/confirm/+server.js` and populate with the following:
Create a new file at `src/routes/auth/confirm/+server.ts` and populate with the following:
```js src/routes/auth/confirm/+server.js
import { redirect } from '@sveltejs/kit';
```ts src/routes/auth/confirm/+server.ts
import { redirect } from '@sveltejs/kit'
export const GET = async (event) => {
const {
url,
locals: { supabase }
} = event;
const token_hash = url.searchParams.get('token_hash') as string;
const type = url.searchParams.get('type') as string;
const next = url.searchParams.get('next') ?? '/';
const {
url,
locals: { supabase },
} = event
const token_hash = url.searchParams.get('token_hash') as string
const type = url.searchParams.get('type') as string
const next = url.searchParams.get('next') ?? '/'
if (token_hash && type) {
const { error } = await supabase.auth.verifyOtp({ token_hash, type });
const { error } = await supabase.auth.verifyOtp({ token_hash, type })
if (!error) {
throw redirect(303, `/${next.slice(1)}`);
throw redirect(303, `/${next.slice(1)}`)
}
}
// return the user to an error page with some instructions
throw redirect(303, '/auth/auth-code-error');
};
throw redirect(303, '/auth/auth-code-error')
}
```
</TabPanel>