fix: fix build error
This commit is contained in:
parent
8e182b4601
commit
21e6b2fc3b
@ -34,8 +34,8 @@ export default function LoginPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error.message.includes("Network Error")) {
|
if (error instanceof Error && error.message.includes("Network Error")) {
|
||||||
console.error("Problème de connexion au serveur");
|
console.error("Problème de connexion au serveur");
|
||||||
}
|
}
|
||||||
console.error("Autre = ", error);
|
console.error("Autre = ", error);
|
||||||
|
|||||||
@ -17,7 +17,6 @@ import { Admin } from "#/types";
|
|||||||
|
|
||||||
export default function Admins() {
|
export default function Admins() {
|
||||||
const { data: session, status } = useSession();
|
const { data: session, status } = useSession();
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
const [openModal, setOpenModal] = useState(false);
|
const [openModal, setOpenModal] = useState(false);
|
||||||
const [openDeleteModal, setOpenDeleteModal] = useState(false);
|
const [openDeleteModal, setOpenDeleteModal] = useState(false);
|
||||||
const [openEditModal, setOpenEditModal] = 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) => {
|
mutationFn: async (id: string) => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.delete(
|
const response = await axios.delete(
|
||||||
|
|||||||
@ -12,16 +12,14 @@ import { Modal } from "#/components/modal";
|
|||||||
import Table from "#/components/table/table";
|
import Table from "#/components/table/table";
|
||||||
import Form from "#/components/form/form";
|
import Form from "#/components/form/form";
|
||||||
import { icons } from "#/assets/icons";
|
import { icons } from "#/assets/icons";
|
||||||
import { adminSchema, companySchema } from "#/schema";
|
import { companySchema } from "#/schema";
|
||||||
import { Admin, Company } from "#/types";
|
import { Admin, Company } from "#/types";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
export default function Organizations() {
|
export default function Organizations() {
|
||||||
const { data: session, status } = useSession();
|
const { data: session, status } = useSession();
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
const [openModal, setOpenModal] = useState(false);
|
const [openModal, setOpenModal] = useState(false);
|
||||||
const [openDeleteModal, setOpenDeleteModal] = useState(false);
|
const [openDeleteModal, setOpenDeleteModal] = useState(false);
|
||||||
const [openEditModal, setOpenEditModal] = useState(false);
|
|
||||||
const [selectedAdminId, setSelectedAdminId] = useState<string | null>(null);
|
const [selectedAdminId, setSelectedAdminId] = useState<string | null>(null);
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
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({
|
const deleteMutation = useMutation({
|
||||||
mutationFn: async (id: string) => {
|
mutationFn: async (id: string) => {
|
||||||
try {
|
try {
|
||||||
@ -401,13 +371,13 @@ export default function Organizations() {
|
|||||||
name: "owner",
|
name: "owner",
|
||||||
label: "Administrateur",
|
label: "Administrateur",
|
||||||
type: "select",
|
type: "select",
|
||||||
options: users?.map((user: {id: string, name: string}) => ({
|
options: users?.map((user: { id: string; name: string }) => ({
|
||||||
label: user.name,
|
label: user.name,
|
||||||
value: user.id,
|
value: user.id,
|
||||||
})) || [],
|
})) || [],
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
submit={createMutation.mutate}
|
submit={createMutation.mutate} // Le type est maintenant compatible
|
||||||
schema={companySchema}
|
schema={companySchema}
|
||||||
child={
|
child={
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Inter } from "next/font/google";
|
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import NextTopLoader from "nextjs-toploader";
|
import NextTopLoader from "nextjs-toploader";
|
||||||
import "../assets/css/ruben-ui.css"
|
import "../assets/css/ruben-ui.css"
|
||||||
import { AuthProvider } from "#/components/provider/authProvider";
|
import { AuthProvider } from "#/components/provider/authProvider";
|
||||||
import { QueryClientProvide } from "#/components/provider/queryClient";
|
import { QueryClientProvide } from "#/components/provider/queryClient";
|
||||||
|
|
||||||
const inter = Inter({ subsets: ["latin"] });
|
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Private Docs",
|
title: "Private Docs",
|
||||||
description: "L'appli de gestion de documents par excellence !",
|
description: "L'appli de gestion de documents par excellence !",
|
||||||
|
|||||||
@ -7,8 +7,6 @@ import Link from "next/link";
|
|||||||
import Theme from "./theme";
|
import Theme from "./theme";
|
||||||
import { signOutFunc } from "#/lib/function";
|
import { signOutFunc } from "#/lib/function";
|
||||||
|
|
||||||
import ProfilePicture from "../../assets/icons/profile.svg"
|
|
||||||
|
|
||||||
export default function AdminHeader() {
|
export default function AdminHeader() {
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as Dialog from "@radix-ui/react-dialog";
|
import * as Dialog from "@radix-ui/react-dialog";
|
||||||
import { ReactNode, useState } from "react";
|
import { ReactNode } from "react";
|
||||||
|
|
||||||
export function Modal({
|
export function Modal({
|
||||||
trigger,
|
trigger,
|
||||||
|
|||||||
@ -25,7 +25,7 @@ export default function Statistics() {
|
|||||||
if(response.data) {
|
if(response.data) {
|
||||||
return response.data as Stats
|
return response.data as Stats
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,9 +10,9 @@ import {
|
|||||||
Table as TableType,
|
Table as TableType,
|
||||||
} from "@tanstack/react-table"
|
} from "@tanstack/react-table"
|
||||||
import { ReactNode, useEffect, useRef, useState } from "react";
|
import { ReactNode, useEffect, useRef, useState } from "react";
|
||||||
import { clsx, type ClassValue } from "clsx"
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { icons } from "#/assets/icons";
|
import { icons } from "#/assets/icons";
|
||||||
|
import clsx from "clsx";
|
||||||
|
|
||||||
interface DataTableProps<TData, TValue> {
|
interface DataTableProps<TData, TValue> {
|
||||||
columns: ColumnDef<TData, TValue>[]
|
columns: ColumnDef<TData, TValue>[]
|
||||||
@ -63,12 +63,16 @@ export default function Table<TData, TValue>({
|
|||||||
table.getIsSomePageRowsSelected() && !table.getIsAllPageRowsSelected();
|
table.getIsSomePageRowsSelected() && !table.getIsAllPageRowsSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("SELECTED ALL = ", table.getSelectedRowModel().rows)
|
const selectedRows = table.getSelectedRowModel().rows;
|
||||||
console.log("SELECTED = ", table.getRowModel().rows.filter((row) => row.getIsSelected()).map(row => row.original))
|
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
|
||||||
table.getIsAllPageRowsSelected(),
|
|
||||||
table.getRowModel()
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const totalPages = table.getPageCount()
|
const totalPages = table.getPageCount()
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { FormEventHandler, ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
import { ZodSchema } from "zod";
|
import { ZodSchema } from "zod";
|
||||||
export interface Option {
|
export interface Option {
|
||||||
label: string
|
label: string
|
||||||
@ -17,7 +17,7 @@ export interface FloatingLabelInputProps {
|
|||||||
onChange?: (value: string) => void;
|
onChange?: (value: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FormProps {
|
export interface FormProps{
|
||||||
title?: string,
|
title?: string,
|
||||||
fields: FloatingLabelInputProps[],
|
fields: FloatingLabelInputProps[],
|
||||||
submit: (param: any) => unknown,
|
submit: (param: any) => unknown,
|
||||||
@ -45,10 +45,11 @@ export interface Stats {
|
|||||||
export interface Company {
|
export interface Company {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
|
description?: string;
|
||||||
is_premium: boolean
|
is_premium: boolean
|
||||||
status: string
|
status: string
|
||||||
owner: Owner
|
owner: Owner
|
||||||
total_users: number
|
total_users?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Owner {
|
export interface Owner {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user