Skip to content

Commit

Permalink
Added required dependencies and files to use React Admin
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLeChat committed Dec 20, 2023
1 parent 606ea23 commit 9e64e14
Show file tree
Hide file tree
Showing 4 changed files with 1,278 additions and 88 deletions.
44 changes: 44 additions & 0 deletions app/[locale]/administration/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Route vers la page d'administration du site.
//

// Importation des dépendances.
import dynamic from "next/dynamic";
import { redirect } from "next/navigation";
import type { Metadata } from "next";
import { unstable_setRequestLocale } from "next-intl/server";

// Importation des fonctions utilitaires.
import { auth } from "@/utilities/next-auth";

// Importation des composants.
const Administration = dynamic( () => import( "../components/administration" ), {
ssr: false
} );

// Déclaration des propriétés de la page.
export const metadata: Metadata = {
title: "Administration – Simple File Storage"
};

// Affichage de la page.
export default async function Page( {
params: { locale }
}: {
params: { locale: string };
} )
{
// Définition de la langue de la page.
unstable_setRequestLocale( locale );

// Vérification de la session utilisateur.
const session = await auth();

if ( !session )
{
redirect( "/" );
}

// Affichage du rendu HTML de la page.
return <Administration />;
}
13 changes: 13 additions & 0 deletions app/[locale]/components/administration.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Composant de la page d'administration.
//

"use client";

// Importation des dépendances.
import { Admin } from "react-admin";

export default function Administration()
{
return <Admin />;
}
Loading

0 comments on commit 9e64e14

Please sign in to comment.