forked from Kiranism/next-shadcn-dashboard-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
92 changed files
with
1,383 additions
and
1,305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
{} | ||
{ | ||
"arrowParens": "always", | ||
"bracketSpacing": true, | ||
"semi": true, | ||
"useTabs": false, | ||
"trailingComma": "none", | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"endOfLine": "lf", | ||
"plugins": ["prettier-plugin-tailwindcss"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import { createUploadthing, type FileRouter } from "uploadthing/next"; | ||
import { createUploadthing, type FileRouter } from 'uploadthing/next'; | ||
|
||
const f = createUploadthing(); | ||
|
||
const auth = () => ({ id: "fakeId" }); // Fake auth function | ||
const auth = () => ({ id: 'fakeId' }); // Fake auth function | ||
|
||
// FileRouter for your app, can contain multiple FileRoutes | ||
export const ourFileRouter = { | ||
// Define as many FileRoutes as you like, each with a unique routeSlug | ||
imageUploader: f({ image: { maxFileSize: "4MB", maxFileCount: 3 } }) | ||
imageUploader: f({ image: { maxFileSize: '4MB', maxFileCount: 3 } }) | ||
// Set permissions and file types for this FileRoute | ||
.middleware(async ({}) => { | ||
// This code runs on your server before upload | ||
const user = await auth(); | ||
|
||
// If you throw, the user will not be able to upload | ||
if (!user) throw new Error("Unauthorized"); | ||
if (!user) throw new Error('Unauthorized'); | ||
|
||
// Whatever is returned here is accessible in onUploadComplete as `metadata` | ||
return { userId: user.id }; | ||
}) | ||
.onUploadComplete(async () => { | ||
// This code RUNS ON YOUR SERVER after upload | ||
}), | ||
}) | ||
} satisfies FileRouter; | ||
|
||
export type OurFileRouter = typeof ourFileRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { createNextRouteHandler } from "uploadthing/next"; | ||
import { createNextRouteHandler } from 'uploadthing/next'; | ||
|
||
import { ourFileRouter } from "./core"; | ||
import { ourFileRouter } from './core'; | ||
|
||
// Export routes for Next App Router | ||
export const { GET, POST } = createNextRouteHandler({ | ||
router: ourFileRouter, | ||
router: ourFileRouter | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.