fix(Api sending error when no user found): Api sending error when no user found

This commit is contained in:
Laurian-Dufrechou
2023-05-22 17:12:44 +02:00
parent 8cbbbc3c0f
commit 7070b4f6ae
2 changed files with 4 additions and 9 deletions
+2 -2
View File
@@ -58,9 +58,9 @@ const get = async (req, res) => {
return null;
});
if (users.length === 0 || users === undefined || users === null) {
return res.status(500).send({ error: "Aucun profil trouvé" });
return res.status(200).send({ users: [], message: "Aucun profil trouvé" });
}
return res.status(200).send({ users });
return res.status(200).send({ users: users, message: "Profil(s) trouvé(s)" });
};
// faire une API pour ajouter un like / dislike
+2 -7
View File
@@ -189,12 +189,7 @@ export default function UserProfile() {
Modifiez les champs en les selectionnants
</Text>
<Box
position={"relative"}
as="form"
onSubmit={handleSubmit(saveData)}
width={"80%"}
>
<Box as="form" onSubmit={handleSubmit(saveData)} width={"80%"}>
<Flex width={"100%"} justify={"space-between"} mb={"1rem"}>
<Box>
<CustomEditable
@@ -347,7 +342,7 @@ export default function UserProfile() {
/>
</Box>
<Divider colorScheme={"purple"} />
<Center position={"sticky"} bottom={0} gap={"1rem"} my={"1rem"}>
<Center gap={"1rem"} my={"1rem"}>
<Button
colorScheme={"purple"}
isLoading={currentlyLoading}