fix: fix build error

This commit is contained in:
Orace.A 2025-03-28 14:33:44 +01:00
parent 8e182b4601
commit 21e6b2fc3b
10 changed files with 22 additions and 53 deletions

View File

@ -34,8 +34,8 @@ export default function LoginPage() {
}
}
return result
} catch (error: any) {
if (error.message.includes("Network Error")) {
} catch (error: unknown) {
if (error instanceof Error && error.message.includes("Network Error")) {
console.error("Problème de connexion au serveur");
}
console.error("Autre = ", error);

View File

@ -17,7 +17,6 @@ import { Admin } from "#/types";
export default function Admins() {
const { data: session, status } = useSession();
const [open, setOpen] = useState(false);
const [openModal, setOpenModal] = useState(false);
const [openDeleteModal, setOpenDeleteModal] = useState(false);
const [openEditModal, setOpenEditModal] = useState(false);

View File

@ -42,7 +42,7 @@ export default function HomePage () {
}
})
const { mutate, isPending } = useMutation({
const { mutate } = useMutation({
mutationFn: async (id: string) => {
try {
const response = await axios.delete(

View File

@ -12,16 +12,14 @@ import { Modal } from "#/components/modal";
import Table from "#/components/table/table";
import Form from "#/components/form/form";
import { icons } from "#/assets/icons";
import { adminSchema, companySchema } from "#/schema";
import { companySchema } from "#/schema";
import { Admin, Company } from "#/types";
import Link from "next/link";
export default function Organizations() {
const { data: session, status } = useSession();
const [open, setOpen] = useState(false);
const [openModal, setOpenModal] = useState(false);
const [openDeleteModal, setOpenDeleteModal] = useState(false);
const [openEditModal, setOpenEditModal] = useState(false);
const [selectedAdminId, setSelectedAdminId] = useState<string | null>(null);
const queryClient = useQueryClient();
@ -106,34 +104,6 @@ export default function Organizations() {
},
});
const updateMutation = useMutation({
mutationFn: async (data: {
id: string;
last_name: string;
first_name: string;
email: string;
}) => {
try {
const response = await axios.put(
`https://private-docs-api.intside.co/companies/${data.id}/`,
data,
{ headers: { Authorization: `Bearer ${session?.user.access_token}` } }
);
if (response.status === 200 || response.status === 201) {
console.log("modification réussie !");
setOpenEditModal(false);
}
} catch (error) {
console.error("Erreur lors de la mise à jour", error);
}
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["organizations"] });
refetch();
},
});
const deleteMutation = useMutation({
mutationFn: async (id: string) => {
try {
@ -401,13 +371,13 @@ export default function Organizations() {
name: "owner",
label: "Administrateur",
type: "select",
options: users?.map((user: {id: string, name: string}) => ({
options: users?.map((user: { id: string; name: string }) => ({
label: user.name,
value: user.id,
})) || [],
},
]}
submit={createMutation.mutate}
submit={createMutation.mutate} // Le type est maintenant compatible
schema={companySchema}
child={
<button

View File

@ -1,13 +1,10 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import NextTopLoader from "nextjs-toploader";
import "../assets/css/ruben-ui.css"
import { AuthProvider } from "#/components/provider/authProvider";
import { QueryClientProvide } from "#/components/provider/queryClient";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: "Private Docs",
description: "L'appli de gestion de documents par excellence !",

View File

@ -7,8 +7,6 @@ import Link from "next/link";
import Theme from "./theme";
import { signOutFunc } from "#/lib/function";
import ProfilePicture from "../../assets/icons/profile.svg"
export default function AdminHeader() {
const [open, setOpen] = React.useState(false);

View File

@ -1,5 +1,5 @@
import * as Dialog from "@radix-ui/react-dialog";
import { ReactNode, useState } from "react";
import { ReactNode } from "react";
export function Modal({
trigger,

View File

@ -25,7 +25,7 @@ export default function Statistics() {
if(response.data) {
return response.data as Stats
}
} catch (error: any) {
} catch (error) {
console.error(error)
}
}

View File

@ -10,9 +10,9 @@ import {
Table as TableType,
} from "@tanstack/react-table"
import { ReactNode, useEffect, useRef, useState } from "react";
import { clsx, type ClassValue } from "clsx"
import Image from "next/image";
import { icons } from "#/assets/icons";
import clsx from "clsx";
interface DataTableProps<TData, TValue> {
columns: ColumnDef<TData, TValue>[]
@ -63,12 +63,16 @@ export default function Table<TData, TValue>({
table.getIsSomePageRowsSelected() && !table.getIsAllPageRowsSelected();
}
console.log("SELECTED ALL = ", table.getSelectedRowModel().rows)
console.log("SELECTED = ", table.getRowModel().rows.filter((row) => row.getIsSelected()).map(row => row.original))
const selectedRows = table.getSelectedRowModel().rows;
const filteredSelectedRows = table
.getRowModel()
.rows.filter((row) => row.getIsSelected())
.map((row) => row.original);
console.log("SELECTED ALL = ", selectedRows);
console.log("SELECTED = ", filteredSelectedRows);
}, [
table.getIsSomePageRowsSelected(),
table.getIsAllPageRowsSelected(),
table.getRowModel()
table
]);
const totalPages = table.getPageCount()

View File

@ -1,4 +1,4 @@
import { FormEventHandler, ReactNode } from "react";
import { ReactNode } from "react";
import { ZodSchema } from "zod";
export interface Option {
label: string
@ -17,7 +17,7 @@ export interface FloatingLabelInputProps {
onChange?: (value: string) => void;
}
export interface FormProps {
export interface FormProps{
title?: string,
fields: FloatingLabelInputProps[],
submit: (param: any) => unknown,
@ -45,10 +45,11 @@ export interface Stats {
export interface Company {
id: string
name: string
description?: string;
is_premium: boolean
status: string
owner: Owner
total_users: number
total_users?: number
}
export interface Owner {