-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
6de72f3
commit 35e81ab
Showing
6 changed files
with
51 additions
and
13 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
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,8 +1,17 @@ | ||
import Link from "next/link"; | ||
import React from "react"; | ||
import { auth } from "@clerk/nextjs/server"; | ||
import { redirect } from "next/navigation"; | ||
|
||
const Dashboard = () => { | ||
return <div className="w-full h-full">Analytics Data</div>; | ||
}; | ||
export default async function AdminDashboard() { | ||
const { sessionClaims } = auth(); | ||
|
||
export default Dashboard; | ||
if (sessionClaims?.metadata.role !== "admin") { | ||
redirect("/"); | ||
} | ||
|
||
return ( | ||
<> | ||
<h1>This is the admin dashboard</h1> | ||
<p>This page is restricted to users with the admin role.</p> | ||
</> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import mongoose from "mongoose"; | ||
const { Schema } = mongoose; | ||
|
||
const userSchema = new Schema({ | ||
name: String, | ||
category: String, | ||
mainImageUrl: String, | ||
images: Array, | ||
price: String, //todo make price and object price:{actualPrice:"", discountedPrice:"", isSaleOn:false} | ||
excerpt: String, | ||
description: String, | ||
rating: String, | ||
reviews: Array, | ||
}); | ||
|
||
export default mongoose.models.Product || mongoose.model("Product", userSchema); |
Empty file.