mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
refactor: Transformation des requetes vers le back en action ajout des
erreurs 400 et refresh lors d'un envoie de formulaire
This commit is contained in:
@ -4,8 +4,8 @@ import React, { useState, useEffect } from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { Users, Clock, CalendarCheck, School, TrendingUp, UserCheck } from 'lucide-react';
|
||||
import Loader from '@/components/Loader';
|
||||
import { BE_SCHOOL_SCHOOLCLASSES_URL } from '@/utils/Url';
|
||||
import ClasseDetails from '@/components/ClasseDetails';
|
||||
import { fetchClasses } from '@/app/lib/schoolAction';
|
||||
|
||||
// Composant StatCard pour afficher une statistique
|
||||
const StatCard = ({ title, value, icon, change, color = "blue" }) => (
|
||||
@ -58,20 +58,15 @@ export default function DashboardPage() {
|
||||
|
||||
const [classes, setClasses] = useState([]);
|
||||
|
||||
const fetchClasses = () => {
|
||||
fetch(`${BE_SCHOOL_SCHOOLCLASSES_URL}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
|
||||
useEffect(() => {
|
||||
// Fetch data for classes
|
||||
fetchClasses().then(data => {
|
||||
setClasses(data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching classes:', error);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
// Fetch data for classes
|
||||
fetchClasses();
|
||||
|
||||
// Simulation de chargement des données
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user