validation & change deisng sidebar dashboard & add menu to profile & handle menu item in profile & add api
This commit is contained in:
+11
-8
@@ -2,7 +2,7 @@ import Content from "@/components/dashboard/Content";
|
||||
import { defineAbilitiesFor } from "@/lib/ability";
|
||||
import { getUser } from "@/lib/auth";
|
||||
import { getStateInfo } from "@/lib/getStateInfo";
|
||||
import { cookies } from "next/headers";
|
||||
import { cookies, headers } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Dashboard() {
|
||||
@@ -12,15 +12,18 @@ export default async function Dashboard() {
|
||||
const cookieStore = cookies();
|
||||
const token = cookieStore.get("access_token");
|
||||
|
||||
// const response = await axios.get(
|
||||
// "https://back-dev.clinic-pro.ir/api/v1/user-profile/e4fd81b4-31bc-4f9a-b300-da23026f9d79"
|
||||
// );
|
||||
|
||||
// console.log(response);
|
||||
|
||||
if (!ability.can("access", "Dashboard")) {
|
||||
return redirect("/");
|
||||
}
|
||||
|
||||
return <Content matchedCity={matchedCity} logged={token} />;
|
||||
const userAgent = headers().get("user-agent") || "";
|
||||
const isMobile = /Mobi|Android/i.test(userAgent);
|
||||
|
||||
return (
|
||||
<Content
|
||||
matchedCity={matchedCity}
|
||||
logged={token}
|
||||
initialTurnsDetails={isMobile}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user