mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Correcting some bugs in statistics.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import React from "react";
|
||||
import {getCurrentOrganizationSlug} from "@/features/dashboard/organization-cookie";
|
||||
import {notFound, redirect} from "next/navigation";
|
||||
|
||||
|
||||
export default async function Layout({children, params}: { children: React.ReactNode , params: { slug: string };}) {
|
||||
const {slug: organizationSlug} = await params
|
||||
console.log(organizationSlug);
|
||||
const currentOrganizationSlug = await getCurrentOrganizationSlug()
|
||||
console.log(currentOrganizationSlug);
|
||||
if(currentOrganizationSlug != organizationSlug) {
|
||||
redirect("charles")
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{children}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import {redirect, useRouter} from "next/navigation";
|
||||
import {useEffect} from "react";
|
||||
import {currentUser} from "@/auth/current-user";
|
||||
|
||||
// export default function NotFound() {
|
||||
//
|
||||
// const router = useRouter();
|
||||
//
|
||||
// useEffect(() => {
|
||||
// router.push('/');
|
||||
// }, [router]);
|
||||
//
|
||||
// return null; // You can return null or a loading spinner while the redirect happens
|
||||
// }
|
||||
|
||||
export default async function NotFound() {
|
||||
|
||||
// const user = await currentUser()
|
||||
// if (!user) {
|
||||
// redirect("/")
|
||||
// }else{
|
||||
// redirect("/")
|
||||
// }
|
||||
|
||||
redirect("/dashboard/default")
|
||||
}
|
||||
@@ -6,22 +6,19 @@ import {CardsWithPagination} from "@/components/wrappers/common/cards-with-pagin
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {ProjectCard} from "@/components/wrappers/dashboard/projects/ProjectCard/ProjectCard";
|
||||
import {requiredCurrentUser} from "@/auth/current-user";
|
||||
import {getCurrentOrganizationSlug} from "@/features/dashboard/organization-cookie";
|
||||
import {currentOrganization} from "@/auth/current-organization";
|
||||
import {notFound} from "next/navigation";
|
||||
|
||||
|
||||
export default async function RoutePage(props: PageParams<{slug: string}>) {
|
||||
const {slug: organizationSlug} = await props.params
|
||||
|
||||
const user = await requiredCurrentUser()
|
||||
|
||||
const currentOrganizationSlug = await getCurrentOrganizationSlug()
|
||||
|
||||
if(currentOrganizationSlug != organizationSlug) {
|
||||
notFound()
|
||||
}
|
||||
// if(currentOrganizationSlug != organizationSlug) {
|
||||
// notFound()
|
||||
// }
|
||||
|
||||
const projects = await prisma.project.findMany({
|
||||
where: {
|
||||
|
||||
@@ -6,7 +6,6 @@ import {AppSidebar} from "@/components/wrappers/dashboard/sideBar/app-sidebar";
|
||||
import {currentUser} from "@/auth/current-user";
|
||||
import {Header} from "@/features/layout/Header";
|
||||
import {prisma} from "@/prisma";
|
||||
import {GlobalStoreProvider} from "@/state-management/provider";
|
||||
|
||||
|
||||
export default async function Layout({children}: { children: React.ReactNode }) {
|
||||
|
||||
Reference in New Issue
Block a user