Fix adminSupabase references to use getAdminClient()
cgen-0e2ffa7314024ea79e3bb3a1375eb7fd
This commit is contained in:
parent
db2c116dec
commit
938e45b84f
1 changed files with 5 additions and 3 deletions
|
|
@ -68,7 +68,8 @@ export default async function handler(req: any, res: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query database for the temporary linking session
|
// Query database for the temporary linking session
|
||||||
const { data: session, error: sessionError } = await adminSupabase
|
const adminClient = getAdminClient();
|
||||||
|
const { data: session, error: sessionError } = await adminClient
|
||||||
.from("discord_linking_sessions")
|
.from("discord_linking_sessions")
|
||||||
.select("user_id")
|
.select("user_id")
|
||||||
.eq("session_token", sessionToken)
|
.eq("session_token", sessionToken)
|
||||||
|
|
@ -92,7 +93,8 @@ export default async function handler(req: any, res: any) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Clean up: delete the temporary session
|
// Clean up: delete the temporary session
|
||||||
await adminSupabase
|
const adminClient2 = getAdminClient();
|
||||||
|
await adminClient2
|
||||||
.from("discord_linking_sessions")
|
.from("discord_linking_sessions")
|
||||||
.delete()
|
.delete()
|
||||||
.eq("session_token", sessionToken);
|
.eq("session_token", sessionToken);
|
||||||
|
|
@ -170,7 +172,7 @@ export default async function handler(req: any, res: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize Supabase client with service role
|
// Initialize Supabase client with service role
|
||||||
const supabase = createClient(supabaseUrl, supabaseServiceRole);
|
const supabase = getAdminClient();
|
||||||
|
|
||||||
// LINKING FLOW: Link Discord to authenticated user
|
// LINKING FLOW: Link Discord to authenticated user
|
||||||
if (isLinkingFlow && authenticatedUserId) {
|
if (isLinkingFlow && authenticatedUserId) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue