-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying another method of making activity requests
- Loading branch information
1 parent
fb6ae4d
commit aaa5fd0
Showing
2 changed files
with
22 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { createClient } from "@/utils/supabase/server"; | ||
import { cookies } from "next/headers"; | ||
|
||
const email = process.env.NEXT_PUBLIC_KEEP_ALIVE_USER ?? ""; | ||
const password = process.env.NEXT_PUBLIC_KEEP_ALIVE_PASSWORD ?? ""; | ||
|
||
export const GET = async (): Promise<Response> => { | ||
try { | ||
const sb = createClient(cookies()); | ||
const payload = { email, password }; | ||
const { error } = await sb.auth.signInWithPassword(payload); | ||
const date = new Date().toISOString(); | ||
if (error != null) throw new Error(error.message); | ||
return Response.json(`Success! ${date}`); | ||
} catch (error) { | ||
const message = (error as Error).message ?? "An error occurred."; | ||
return Response.json(message, { status: 400 }); | ||
} | ||
}; |