validation & change deisng sidebar dashboard & add menu to profile & handle menu item in profile & add api

This commit is contained in:
Ehsan
2025-06-03 00:50:10 +03:30
parent 0217e5e67e
commit dafeebc54f
18 changed files with 142 additions and 95 deletions
+11 -8
View File
@@ -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}
/>
);
}