install and handle casle & prevent page dashboard & handle register and code verfication & get data in clinics page
This commit is contained in:
+10
-1
@@ -1,8 +1,17 @@
|
||||
import Content from "@/components/dashboard/Content";
|
||||
import { defineAbilitiesFor } from "@/lib/ability";
|
||||
import { getUser } from "@/lib/auth";
|
||||
import { getStateInfo } from "@/lib/getStateInfo";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
function UserAccount() {
|
||||
async function UserAccount() {
|
||||
const { matchedCity } = getStateInfo();
|
||||
const user = await getUser();
|
||||
const ability = defineAbilitiesFor(user);
|
||||
|
||||
if (!ability.can("access", "Dashboard")) {
|
||||
return redirect("/");
|
||||
}
|
||||
|
||||
return <Content matchedCity={matchedCity} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user