fix: fix build error
This commit is contained in:
parent
8e182b4601
commit
21e6b2fc3b
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 !",
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -25,7 +25,7 @@ export default function Statistics() {
|
||||
if(response.data) {
|
||||
return response.data as Stats
|
||||
}
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FormEventHandler, ReactNode } from "react";
|
||||
import { ReactNode } from "react";
|
||||
import { ZodSchema } from "zod";
|
||||
export interface Option {
|
||||
label: string
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user