mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-13 17:21:53 +00:00
feat(image des users de la vidéo): image user de la vidéo
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 94 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
@@ -13,16 +13,16 @@ import {
|
|||||||
useCheckboxGroup,
|
useCheckboxGroup,
|
||||||
useDisclosure,
|
useDisclosure,
|
||||||
useToast,
|
useToast,
|
||||||
} from '@chakra-ui/react';
|
} from "@chakra-ui/react";
|
||||||
import {useQueryClient} from '@tanstack/react-query';
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import {RiEditBoxLine} from 'react-icons/ri';
|
import { RiEditBoxLine } from "react-icons/ri";
|
||||||
import CustomCheckbox from './CustomCheckbox';
|
import CustomCheckbox from "./CustomCheckbox";
|
||||||
import {Passion} from '@prisma/client';
|
import { Passion } from "@prisma/client";
|
||||||
|
|
||||||
export default function ModalChoosePassion(props) {
|
export default function ModalChoosePassion(props) {
|
||||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||||
const { user, passions } = props;
|
const { user, passions } = props;
|
||||||
const toast = useToast({position: 'top', isClosable: true});
|
const toast = useToast({ position: "top", isClosable: true });
|
||||||
const client = useQueryClient();
|
const client = useQueryClient();
|
||||||
|
|
||||||
const { value, getCheckboxProps } = useCheckboxGroup({
|
const { value, getCheckboxProps } = useCheckboxGroup({
|
||||||
@@ -37,23 +37,23 @@ export default function ModalChoosePassion(props) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
method: 'PATCH',
|
method: "PUT",
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify(jsonPassions),
|
body: JSON.stringify(jsonPassions),
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch(`/api/users/${user.id}`, options)
|
fetch(`/api/users/${user.id}`, options)
|
||||||
.then(res => res.json())
|
.then((res) => res.json())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toast({
|
toast({
|
||||||
title: 'Centres d\'intérêts mis à jour',
|
title: "Centres d'intérêts mis à jour",
|
||||||
status: 'success',
|
status: "success",
|
||||||
duration: 9000,
|
duration: 9000,
|
||||||
});
|
});
|
||||||
client.invalidateQueries('user');
|
|
||||||
onClose();
|
onClose();
|
||||||
|
client.invalidateQueries({ queryKey: ["userProfile"] });
|
||||||
})
|
})
|
||||||
.catch(err => console.log(err));
|
.catch((err) => console.log(err));
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -62,21 +62,27 @@ export default function ModalChoosePassion(props) {
|
|||||||
Choisir les centres d'intérêts
|
Choisir les centres d'intérêts
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Modal blockScrollOnMount={false} size={'4xl'} isOpen={isOpen}
|
<Modal
|
||||||
onClose={onClose} scrollBehavior={'inside'}>
|
blockScrollOnMount={false}
|
||||||
|
size={"4xl"}
|
||||||
|
isOpen={isOpen}
|
||||||
|
onClose={onClose}
|
||||||
|
scrollBehavior={"inside"}
|
||||||
|
>
|
||||||
<ModalOverlay />
|
<ModalOverlay />
|
||||||
<ModalContent>
|
<ModalContent>
|
||||||
<ModalHeader>Choix des centres d'intérêts</ModalHeader>
|
<ModalHeader>Choix des centres d'intérêts</ModalHeader>
|
||||||
<ModalCloseButton />
|
<ModalCloseButton />
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<Flex gap={'1rem'} flexWrap="wrap">
|
<Flex gap={"1rem"} flexWrap="wrap">
|
||||||
{passions && (
|
{passions &&
|
||||||
passions.map((passion: Passion) => (
|
passions.map((passion: Passion) => (
|
||||||
<CustomCheckbox key={passion.id} text={passion.name}
|
<CustomCheckbox
|
||||||
{...getCheckboxProps({value: passion.id})}/>
|
key={passion.id}
|
||||||
)
|
text={passion.name}
|
||||||
)
|
{...getCheckboxProps({ value: passion.id })}
|
||||||
)}
|
/>
|
||||||
|
))}
|
||||||
</Flex>
|
</Flex>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export default function ModalModifyImages(props) {
|
|||||||
<Button
|
<Button
|
||||||
mr={3}
|
mr={3}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
client.invalidateQueries("user");
|
client.invalidateQueries({ queryKey: ["userProfile"] });
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export default function UserProfile() {
|
|||||||
data: userData,
|
data: userData,
|
||||||
error,
|
error,
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ["user"],
|
queryKey: ["userProfile"],
|
||||||
enabled: status === "authenticated",
|
enabled: status === "authenticated",
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { user } = session as unknown as Session;
|
const { user } = session as unknown as Session;
|
||||||
@@ -149,7 +149,7 @@ export default function UserProfile() {
|
|||||||
status: "success",
|
status: "success",
|
||||||
isClosable: true,
|
isClosable: true,
|
||||||
});
|
});
|
||||||
queryClient.invalidateQueries({ queryKey: ["user"] });
|
queryClient.invalidateQueries({ queryKey: ["userProfile"] });
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
setCurrentlyLoading(false);
|
setCurrentlyLoading(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user