diff --git a/app/_header/upload-form.tsx b/app/_header/upload-form.tsx index 8207c5f..be017ff 100644 --- a/app/_header/upload-form.tsx +++ b/app/_header/upload-form.tsx @@ -62,7 +62,7 @@ const uploadFormSchema = z.object({ ), }); -export type UploadFormSchema = z.infer; +type UploadFormSchema = z.infer; function UploadForm() { const form = useForm({ @@ -77,13 +77,9 @@ function UploadForm() { const { mutate: createPreSignedUrls, data: preSignedUrls, - isError: isPresignedUrlsError, isPending: isCreatingPresignedUrls, } = useMutation({ - mutationFn: () => - handleCreatePreSignedUrl({ - numOfSamples: form.getValues().samples.length, - }), + mutationFn: () => handleCreatePreSignedUrl(form.getValues().samples.length), onSuccess: (preSignedUrls) => { return uploadToS3({ zipFileSignedUrl: preSignedUrls.zipFileSignedUrl.url, @@ -106,18 +102,6 @@ function UploadForm() { onSuccess: () => persistData(), }); - function createPublicUrl({ - key, - visibility, - }: { - key: string; - visibility: "private" | "public"; - }) { - const bucketName = - visibility === "private" ? "noos-private-assets" : "noos-public-assets"; - return `https://localhost.localstack.cloud:4566/${bucketName}/${key}`; - } - const { mutate: persistData, isPending: isPersistingData } = useMutation({ mutationFn: async () => { if (!preSignedUrls) throw new Error("Pre-signed urls not found"); @@ -161,12 +145,6 @@ function UploadForm() { createPreSignedUrls(); } - console.log({ - preSignedUrls, - isCreatingPresignedUrls, - isPresignedUrlsError, - }); - return (
@@ -265,4 +243,16 @@ function UploadForm() { ); } +function createPublicUrl({ + key, + visibility, +}: { + key: string; + visibility: "private" | "public"; +}) { + const bucketName = + visibility === "private" ? "noos-private-assets" : "noos-public-assets"; + return `https://localhost.localstack.cloud:4566/${bucketName}/${key}`; +} + export default UploadForm; diff --git a/lib/aws/actions.ts b/lib/aws/actions.ts index b672cd5..dbeec97 100644 --- a/lib/aws/actions.ts +++ b/lib/aws/actions.ts @@ -6,11 +6,7 @@ import { AWS_PRIVATE_BUCKET_NAME, AWS_PUBLIC_BUCKET_NAME } from "@/cfg"; import { addSampleToSamplePack, createSamplePack } from "@/lib/db/mod"; import "server-only"; -export async function handleCreatePreSignedUrl({ - numOfSamples, -}: { - numOfSamples: number; -}) { +export async function handleCreatePreSignedUrl(numOfSamples: number) { try { const user = await currentUser(); if (!user) throw new Error(); diff --git a/next.config.ts b/next.config.ts index 6e52369..1a3f146 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,6 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ images: { remotePatterns: [ {