ablc
ablc
TTCTheo's Typesafe Cult
Created by ablc on 6/7/2023 in #questions
SyntaxError for UploadThing
using any UploadThing component breaks my code, because of this error
- error SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
- error SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
I dont seem to know where I'm messing up,
"use client";
// You need to import our styles for the button to look right. Best to import in the root /layout.tsx but this is fine
import "@uploadthing/react/styles.css";

import { UploadButton } from "@uploadthing/react";

import { OurFileRouter } from "@/app/api/uploadthing/core";

export default function Upload() {
return (
<div>
<UploadButton<OurFileRouter>
endpoint="imageUploader"
onClientUploadComplete={(res) => {
// Do something with the response
console.log("Files: ", res);
alert("Upload Completed");
}}
onUploadError={(error: Error) => {
// Do something with the error.
alert(`ERROR! ${error.message}`);
}}
/>

</div>
);
}
"use client";
// You need to import our styles for the button to look right. Best to import in the root /layout.tsx but this is fine
import "@uploadthing/react/styles.css";

import { UploadButton } from "@uploadthing/react";

import { OurFileRouter } from "@/app/api/uploadthing/core";

export default function Upload() {
return (
<div>
<UploadButton<OurFileRouter>
endpoint="imageUploader"
onClientUploadComplete={(res) => {
// Do something with the response
console.log("Files: ", res);
alert("Upload Completed");
}}
onUploadError={(error: Error) => {
// Do something with the error.
alert(`ERROR! ${error.message}`);
}}
/>

</div>
);
}
18 replies
TTCTheo's Typesafe Cult
Created by ablc on 3/26/2023 in #questions
DayJS Relative Time bug - during T3 Stack Tutorial
2 replies
TTCTheo's Typesafe Cult
Created by ablc on 3/24/2023 in #questions
Property 'authorId' does not exist on type 'Post[]'.
7 replies