Skip to content

Commit

Permalink
fix(upload-file): cors
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexcited committed Aug 12, 2023
1 parent 994d42e commit f4d1e22
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion supabase/functions/upload-file/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ import { serve } from "https://deno.land/[email protected]/http/server.ts"
import type { UploadedFile, UserProfile } from "../../../src/types/api.ts";
import { supabase, getUserProfile } from "../_shared/supabase.ts";

const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey',
}

const json = <T>(data: T, options?: { status: number }) => new Response(
JSON.stringify(data),
{ headers: { "Content-Type": "application/json" }, status: options?.status ?? 200 }
{ headers: { "Content-Type": "application/json", ...corsHeaders }, status: options?.status ?? 200 }
);

/**
Expand Down

0 comments on commit f4d1e22

Please sign in to comment.