Skip to content

Commit

Permalink
fix: upload-file
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Sep 9, 2023
1 parent b0be278 commit 30729a9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions supabase/functions/upload-file/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { supabase, getUserProfile, getPermissionForWorkspace } from "../_shared/

const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "PUT",
"Access-Control-Allow-Headers": "authorization, x-client-info",
"Access-Control-Allow-Methods": "PUT, OPTIONS",
"Access-Control-Allow-Headers": "authorization, x-client-info, apikey, content-type",
};

const json = <T>(data: T, options?: { status: number }) => new Response(
Expand Down Expand Up @@ -80,6 +80,10 @@ serve(async (req: Request) => {
data: { uploaded: newUploadsInDatabase }
});
}

else if (req.method === 'OPTIONS') {
return new Response('ok', { headers: corsHeaders })
}

return json({
success: false,
Expand Down

0 comments on commit 30729a9

Please sign in to comment.