diff --git a/containers/react/src/components/Messages/Chats.tsx b/containers/react/src/components/Messages/Chats.tsx
index 44328f1e..292df894 100644
--- a/containers/react/src/components/Messages/Chats.tsx
+++ b/containers/react/src/components/Messages/Chats.tsx
@@ -27,6 +27,7 @@ import PartyInvite from "./PartyInvite.tsx";
// import {User, Conv, Message} from "../../../interfaces.tsx"
import {User, Conv} from "../../../interfaces.tsx"
+import { IoLogoOctocat } from "react-icons/io5";
const TouchDiv = styled.div`
margin-left: 10px;
@@ -388,12 +389,13 @@ function Chats(){
-

+ {/*

*/}
+
{isLoading || !user ? (
Loading...
) : (
- {user.nickname}
+ Chat
)}
{/*
@@ -462,7 +464,7 @@ function Chats(){
))}
-
+
null}>
{showAddFriendAlert && addFriend && (
@@ -475,7 +477,7 @@ function Chats(){
-
+
null}>
{showBlockAlert && block && (
diff --git a/containers/react/src/components/Messages/Message.tsx b/containers/react/src/components/Messages/Message.tsx
index da8479ad..458453ea 100644
--- a/containers/react/src/components/Messages/Message.tsx
+++ b/containers/react/src/components/Messages/Message.tsx
@@ -6,11 +6,7 @@
/* By: sadjigui +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/01 18:24:46 by apommier #+# #+# */
-<<<<<<< HEAD
-/* Updated: 2023/06/23 19:33:40 by sadjigui ### ########.fr */
-=======
-/* Updated: 2023/06/20 19:05:10 by apommier ### ########.fr */
->>>>>>> apommier
+/* Updated: 2023/06/23 21:14:59 by sadjigui ### ########.fr */
/* */
/* ************************************************************************** */
diff --git a/containers/react/src/components/Profile/EditName.tsx b/containers/react/src/components/Profile/EditName.tsx
index 35123169..c3f058f0 100644
--- a/containers/react/src/components/Profile/EditName.tsx
+++ b/containers/react/src/components/Profile/EditName.tsx
@@ -1,12 +1,13 @@
import {motion} from "framer-motion"
// import Backdrop from "../Sidebar/Backdrop"
import {Link} from 'react-router-dom';
-import { UserProfile } from "../../DataBase/DataUserProfile";
+// import { UserProfile } from "../../DataBase/DataUserProfile";
import {useState} from 'react';
import "../../styles/Profile.css"
import api from '../../script/axiosApi.tsx';
import React from "react";
+import RedAlert from "../Alert/RedAlert.tsx";
const dropIn = {
hidden: {
@@ -21,14 +22,17 @@ const dropIn = {
}
// const changeName = ({handleclose, name}) => {
-// return (
-// UserProfile.UserName = name
+ // return (
+ // UserProfile.UserName = name
// )
// }
const ModalEdit = ( handleClose ) => {
// let new_name = "";
const [nickname, setNickname] = useState("");
+ const [closeModal, setModalClose] = useState(false);
+ const [err, setErr] = useState(false);
+ const close = () => setErr(false);
const handler = e =>
{
@@ -46,13 +50,29 @@ const ModalEdit = ( handleClose ) => {
};
postNickname();
}
-
+
const handlePostNickname = async () =>
{
console.log("nickname=" ,nickname)
try{
- await api.post("/nickname", {nickname: nickname})
- window.location.reload();
+ const ret = await api.post("/nickname", {nickname: nickname});
+ // console.log("cest ici = ",ret);
+ // if (!ret)
+ console.log("test ret =",ret.data);
+ if(ret.data)
+ {
+ console.log ("ici error = ", ret.data);
+ // window.location.reload();
+ }
+ else if (!ret.data)
+ {
+ console.log ("nickname already set = ", ret.data);
+
+ setErr(true);
+ setModalClose(true);
+ }
+
+
// setUser(tmpUser.data);
// setIsLoading(false)
}
@@ -73,17 +93,22 @@ const ModalEdit = ( handleClose ) => {
animate="visible"
exit="exit">
Type your new name
-
+
-
handlePostNickname()}>
+
change
{/* change */}
+ {
+ err ? (
+
+ ) : ("")
+ }
+
+ )
+ }
- )
-}
-
-export default ModalEdit
\ No newline at end of file
+ export default ModalEdit
\ No newline at end of file
diff --git a/containers/react/src/pages/Home.tsx b/containers/react/src/pages/Home.tsx
index ecfbc71e..2e2dba72 100644
--- a/containers/react/src/pages/Home.tsx
+++ b/containers/react/src/pages/Home.tsx
@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* Home.tsx :+: :+: :+: */
/* +:+ +:+ +:+ */
-/* By: apommier
+#+ +:+ +#+ */
+/* By: sadjigui +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/09 08:19:04 by apommier #+# #+# */
-/* Updated: 2023/06/20 15:27:00 by apommier ### ########.fr */
+/* Updated: 2023/06/23 22:46:23 by sadjigui ### ########.fr */
/* */
/* ************************************************************************** */
@@ -178,7 +178,7 @@ function Profile () {
{isLoading || !user ? (
Loading...
) : (
- {user.nickname}
+ {user.nickname}
)}
@@ -242,7 +242,7 @@ function Home () {
}
};
fetchSuccess();
- })
+ },[])
return (