Skip to content

Commit

Permalink
refactor: rename api routes and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
trobonox committed Aug 12, 2023
1 parent 243298b commit 0bc9022
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 7 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { type APIEvent, json, redirect } from "solid-start"
import { supabase, getUserProfile } from "@/supabase/server";
import type { UserProfile } from "@/types/api";

export const PUT = () => {
const url = new URL(`/functions/v1/upload-file`, import.meta.env.VITE_SUPABASE_PROJECT_URL as string)
Expand Down
4 changes: 1 addition & 3 deletions src/routes/dashboard/(overview).tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Page: Component = () => {

createEffect(on(currentWorkspaceId, async (workspaceId: string) => {
const response = await fetch(
`/api/get_files?workspace_id=${currentWorkspaceId()}`,
`/api/workspace?workspace_id=${currentWorkspaceId()}`,
{
method: "GET",
headers: { authorization: auth.profile!.api_token },
Expand Down Expand Up @@ -87,8 +87,6 @@ const Page: Component = () => {
else {
return <IconFileOutline class="text-xl" />
}

return "yeeet";
}

createEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const makeFileUpload = async (files: FileList | Array<File>, options?: {
headers.authorization = auth.profile.api_token;
}

const response = await fetch("/api/files", {
const response = await fetch("/api/workspace/upload", {
method: "PUT",
headers,
body
Expand Down
2 changes: 1 addition & 1 deletion vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://openapi.vercel.sh/vercel.json",
"redirects": [
{
"source": "/api/files",
"source": "/api/workspace",
"destination": "https://kcpxeoxkmblpivpgwdsm.supabase.co/functions/v1/upload-file",
"permanent": true
}
Expand Down

0 comments on commit 0bc9022

Please sign in to comment.