Skip to content

Commit

Permalink
Call exists_machine_id func in supabase keep alive
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofandrin committed Feb 2, 2025
1 parent 7a3bd5b commit 5c06194
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/api/supabase-keep-alive/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ const supabase = createClient(supabaseUrl, supabaseKey)

export async function GET() {
try {
const { data, error } = await supabase.from("keep-alive").select()
let error
const respKeepAlive = await supabase.from("keep-alive").select()
error = respKeepAlive.error
if (error) throw new Error(error.message)
return Response.json(data)

const respExistsMachineId = await supabase.rpc("exists_machine_id", { mid_input: "foo" })
error = respExistsMachineId.error
return Response.json({ message: "Successful" })
} catch (error) {
const message = (error as Error).message ?? "An error occurred."
return Response.json({ error: message }, { status: 400 })
Expand Down

0 comments on commit 5c06194

Please sign in to comment.