diff --git a/.eslintcache b/.eslintcache index f9e16ae..66dfc4f 100644 --- a/.eslintcache +++ b/.eslintcache @@ -1 +1 @@ -[{"D:\\matth\\programation\\my-app\\NSI-Projet\\src\\index.js":"1","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\App.jsx":"2","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\reportWebVitals.js":"3","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\Home.jsx":"4","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\login.jsx":"5","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\signup.jsx":"6","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\friends-liste.jsx":"7","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\components\\chat.jsx":"8","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\components\\statistique.jsx":"9","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\withAuth.jsx":"10","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\barre-gauche.jsx":"11","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\application2.jsx":"12","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\components\\paramètre.jsx":"13","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\components\\friend_nom.jsx":"14","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\barre-amis-gauche.jsx":"15"},{"size":598,"mtime":1614542028508,"results":"16","hashOfConfig":"17"},{"size":1381,"mtime":1617810232026,"results":"18","hashOfConfig":"17"},{"size":375,"mtime":1614542028510,"results":"19","hashOfConfig":"17"},{"size":19028,"mtime":1618475155691,"results":"20","hashOfConfig":"17"},{"size":3455,"mtime":1618218825128,"results":"21","hashOfConfig":"17"},{"size":3463,"mtime":1618218954697,"results":"22","hashOfConfig":"17"},{"size":4050,"mtime":1618389184021,"results":"23","hashOfConfig":"17"},{"size":6965,"mtime":1618348544905,"results":"24","hashOfConfig":"17"},{"size":2499,"mtime":1618158877091,"results":"25","hashOfConfig":"17"},{"size":1566,"mtime":1614542028512,"results":"26","hashOfConfig":"17"},{"size":2446,"mtime":1618388706171,"results":"27","hashOfConfig":"17"},{"size":2972,"mtime":1618348532812,"results":"28","hashOfConfig":"17"},{"size":2548,"mtime":1618348280640,"results":"29","hashOfConfig":"17"},{"size":1818,"mtime":1617387126759,"results":"30","hashOfConfig":"17"},{"size":1508,"mtime":1617811135954,"results":"31","hashOfConfig":"17"},{"filePath":"32","messages":"33","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},"1txmw58",{"filePath":"35","messages":"36","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"37","usedDeprecatedRules":"34"},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"40","messages":"41","errorCount":0,"warningCount":25,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"42","messages":"43","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":"44","usedDeprecatedRules":"34"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":"47","usedDeprecatedRules":"34"},{"filePath":"48","messages":"49","errorCount":0,"warningCount":7,"fixableErrorCount":0,"fixableWarningCount":0,"source":"50","usedDeprecatedRules":"34"},{"filePath":"51","messages":"52","errorCount":0,"warningCount":9,"fixableErrorCount":0,"fixableWarningCount":0,"source":"53","usedDeprecatedRules":"34"},{"filePath":"54","messages":"55","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"56","usedDeprecatedRules":"34"},{"filePath":"57","messages":"58","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},{"filePath":"59","messages":"60","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"61","usedDeprecatedRules":"34"},{"filePath":"62","messages":"63","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"64","usedDeprecatedRules":"34"},{"filePath":"65","messages":"66","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"67","usedDeprecatedRules":"34"},{"filePath":"68","messages":"69","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"70","usedDeprecatedRules":"34"},{"filePath":"71","messages":"72","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"34"},"D:\\matth\\programation\\my-app\\NSI-Projet\\src\\index.js",[],["73","74"],"D:\\matth\\programation\\my-app\\NSI-Projet\\src\\App.jsx",["75","76","77"],"import React, { Component } from 'react';\r\nimport { BrowserRouter, Route, Router, Link, Switch } from \"react-router-dom\"\r\nimport Home from './Home.jsx';\r\nimport Login from './login.jsx';\r\nimport Signup from './signup.jsx'\r\nimport rockets from './components/statistique.jsx'\r\nimport Friendsliste from './friends-liste.jsx'\r\nimport Application2 from './application2'\r\nimport withAuth from './withAuth'\r\nimport Chat from './components/chat.jsx'\r\nimport Parametre from './components/paramètre'\r\nimport './style/app.css'\r\n\r\nclass App extends Component {\r\n // différente route renvoyant un composant react\r\n render() {\r\n return (\r\n \r\n
\r\n \r\n \r\n \r\n \r\n {/*withAuth permet de renvoyer le composant \"Application\" si la vérification des cookies est validé par le server*/}\r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n );\r\n }\r\n}\r\n\r\nexport default App;","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\reportWebVitals.js",[],"D:\\matth\\programation\\my-app\\NSI-Projet\\src\\Home.jsx",["78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102"],"D:\\matth\\programation\\my-app\\NSI-Projet\\src\\login.jsx",["103","104","105","106","107"],"import React, { Component } from 'react';\r\nimport axios from 'axios';\r\nimport { BrowserRouter, Route, Router, Link, Switch } from \"react-router-dom\"\r\nimport './style/login.css';\r\nimport './style/login-responsive.css';\r\n\r\nexport default class login extends Component {\r\n // création des states suivant\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n email : '',\r\n mdp: '',\r\n message:''\r\n };\r\n }\r\n // ajout des changement lorsque le texte de l'input change\r\n handleInputChange = (event) => {\r\n const { value, name } = event.target;\r\n this.setState({\r\n [name]: value\r\n });\r\n }\r\n \r\n // lorsque le formulaire est submit, envoyer la requête POST suivante, qui envois les données\r\n onSubmit = (event) => {\r\n event.preventDefault();\r\n console.log(\"state login : \",this.state)\r\n fetch('http://localhost:4000/authentification/signin', {\r\n method: 'POST',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n body: JSON.stringify({\r\n email:this.state.email,\r\n mdp:this.state.mdp\r\n }),\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n }\r\n })\r\n .then(res => {\r\n if (res.status === 200) {\r\n // s'il y a aucune erreur, renvoyer vers l'acceuil\r\n this.props.history.push('/app/friendlist');\r\n }if (res.status === 401){\r\n // si erreur code est 401, renvoyer ce message\r\n this.setState({ message:'Mot de passee incorrecte'});\r\n } \r\n else {\r\n // sinon, renvoyer ce message\r\n this.setState({message:'Mot de passe ou email incorrecte'});\r\n }\r\n })\r\n }\r\n \r\n render() {\r\n return (\r\n
\r\n
\r\n
\r\n

Hey

\r\n

Si tu n’as pas encore de compte crée en un !

\r\n SING UP\r\n
\r\n
\r\n
\r\n

Login

\r\n \r\n

\r\n \r\n

\r\n \r\n
\r\n

{this.state.message}

\r\n
\r\n
\r\n
\r\n \r\n );\r\n\r\n }\r\n }","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\signup.jsx",["108","109","110","111","112"],"import React, { Component } from 'react';\r\nimport axios from 'axios';\r\nimport { BrowserRouter, Route, Router, Link, Switch } from \"react-router-dom\"\r\nimport './style/singup.css';\r\nimport './style/singup-responsive.css';\r\n\r\nexport default class signup extends Component {\r\n // création des states suivant\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n email : '',\r\n mdp: '',\r\n pseudo:'',\r\n message:''\r\n };\r\n }\r\n // ajout des changement lorsque le texte de l'input change\r\n handleInputChange = (event) => {\r\n const { value, name } = event.target;\r\n this.setState({\r\n [name]: value\r\n });\r\n }\r\n // quand bouton submit pressé, envoyé une requête POST au serveur pour insérer le nouvel utilisateur dans la base de donnée\r\n onSubmit = (event) => {\r\n event.preventDefault();\r\n console.log(\"state signup : \",this.state);\r\n\r\n fetch('http://localhost:4000/authentification/signup', {\r\n method: 'POST',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include',\r\n body: JSON.stringify({\r\n pseudo:this.state.pseudo,\r\n email:this.state.email,\r\n mdp:this.state.mdp\r\n }),\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n }\r\n })\r\n .then((value) => {\r\n if (value.status === 200) {\r\n // s'il y a eu aucune erreur redirigé à l'acceuil\r\n this.props.history.push('/app/friendlist');\r\n console.log(\"info envoyé\");\r\n } else {\r\n // s'il y a eu une erreur, renvoyer le message suivant\r\n this.setState({message:'Pseudo ou email déjà utilisé'});\r\n }\r\n })\r\n\r\n }\r\n \r\n render() {\r\n return (\r\n
\r\n
\r\n
\r\n
\r\n

Create Account

\r\n \r\n

\r\n \r\n

\r\n \r\n

\r\n \r\n
\r\n

{this.state.message}

\r\n
\r\n
\r\n

Welcome back

\r\n

Si tu as déjà un compte, il te suffit de te connecter !

\r\n SIGN IN\r\n
\r\n
\r\n
\r\n );\r\n\r\n }\r\n }","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\friends-liste.jsx",["113","114","115","116","117","118","119"],"import React, { Component } from 'react';\r\nimport { BrowserRouter, Route, Router, Link, Switch } from \"react-router-dom\"\r\nimport Chat from './components/chat';\r\nimport { withRouter } from \"react-router-dom\";\r\nimport Barregauche from './barre-gauche.jsx';\r\nimport StatWithFriend from './components/statistique'\r\nimport './style/friend-liste.css';\r\nimport './style/friend-liste-responsive.css';\r\n\r\n\r\nexport default class friendsliste extends Component {\r\n \r\n // création du State \"friend\"\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n friend : '',\r\n message : '',\r\n amislist: [{_id:0, _pseudo:\"\"}],\r\n firstFriend:\"\",\r\n room:''\r\n };\r\n }\r\n \r\n // ajout des changement lorsque le texte de l'input change\r\n handleInputChange = (event) => {\r\n const { value, name } = event.target;\r\n this.setState({\r\n [name]: value\r\n });\r\n }\r\n\r\n // fonction permettant de faire une requête POST au serveur et d'envoyer les données\r\n onSubmit = (event) => {\r\n event.preventDefault();\r\n console.log(\"state envois demande amis : \",this.state)\r\n // requête POST\r\n fetch('http://localhost:4000/app/newfriend', {\r\n method: 'POST',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n body: JSON.stringify({\r\n new_friend: this.state.friend\r\n }),\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n }\r\n })\r\n // renvois message de réussite ou non\r\n .then(res => {\r\n if (res.status === 200) {\r\n this.setState({message: \"\"})\r\n } else if(res.status === 400){\r\n this.setState({message : \"l'utilisateur rechercher n'existe pas\"})\r\n } else if(res.status === 402){\r\n this.setState({message: \" vous avez déja cette utilisateur en amis\"})\r\n } else{\r\n console.log(\"erreur\")\r\n }\r\n })\r\n }\r\n componentDidMount(){\r\n fetch('http://localhost:4000/app/friendlist', {\r\n method: 'GET',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(response => {\r\n console.log(response)\r\n this.setState({amislist:response.data})\r\n this.setState({firstFriend:response.firstFriend})\r\n console.log(\"state\", this.state.amislist)\r\n })\r\n }\r\n\r\n render() {\r\n const {message} = this.state\r\n const {amislist} = this.state\r\n console.log(\"here\",amislist)\r\n return (\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n \r\n

{message}

\r\n
\r\n
\r\n
\r\n {amislist.map((amis)=>(\r\n \r\n
\r\n

{amis.pseudo}

\r\n
\r\n \r\n ))}\r\n
\r\n
\r\n
\r\n ); \r\n }\r\n }","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\components\\chat.jsx",["120","121","122","123","124","125","126","127","128"],"import React, { Component } from 'react';\r\n\r\nimport { io } from \"socket.io-client\"; \r\nimport { withRouter } from \"react-router-dom\";\r\nimport FriendNom from './friend_nom'\r\nimport trash from '../image/delete.png'\r\n\r\n\r\nconst socket = io('http://localhost:4000');\r\nexport default class Chat extends Component {\r\n // création du state \"message\"\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n message : '',\r\n friendid:'',\r\n groupetext:[{_id:0, text:\"\", author:\"\"}],\r\n room:'',\r\n user_nom:'',\r\n change:false\r\n };\r\n }\r\n // ajout des changement lorsque le texte de l'input change\r\n handleInputChange = (event) => {\r\n const { value, name } = event.target;\r\n this.setState({\r\n [name]: value\r\n });\r\n }\r\n componentDidMount(){\r\n this.setState({friendid:this.props.valeur})\r\n this.setState({user_nom:this.props.nom})\r\n fetch('http://localhost:4000/app/getgroupechatlist', {\r\n method: 'POST',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n body: JSON.stringify({\r\n friendID: this.props.valeur\r\n }),\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(response => {\r\n this.setState({groupetext:response[0].message})\r\n //console.log(response[0].message)\r\n this.setState({room:response[0]._id})\r\n //console.log(this.state.room)\r\n socket.emit('joinRoom', this.state.room)\r\n })\r\n }\r\n\r\n componentDidUpdate(){\r\n if(this.state.friendid !== this.props.valeur){\r\n this.setState({friendid:this.props.valeur})\r\n fetch('http://localhost:4000/app/getgroupechatlist', {\r\n method: 'POST',\r\n credentials: 'include', \r\n body: JSON.stringify({\r\n friendID: this.props.valeur\r\n }),\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(response => {\r\n this.setState({groupetext:response[0].message})\r\n //console.log(response[0].message)\r\n this.setState({room:response[0]._id})\r\n //console.log(this.state.room) \r\n socket.emit('leave')\r\n socket.emit('joinRoom', this.state.room)\r\n })\r\n }\r\n }\r\n\r\n componentDidMount(){\r\n socket.on('message', message =>{\r\n console.log(message)\r\n let {groupetext} = this.state\r\n groupetext.push(message)\r\n //console.log(groupetext)\r\n this.setState({change:true})\r\n console.log(groupetext)\r\n })\r\n socket.on('messageDelete',value =>{\r\n console.log('le message suprimé : ',value)\r\n let {groupetext} = this.state\r\n const index = groupetext.findIndex(mess => mess._id === value)\r\n if(index != -1){\r\n groupetext.splice(index,1)\r\n this.setState({change:true})\r\n }\r\n })\r\n socket.on('info', message =>{\r\n console.log(message)\r\n })\r\n }\r\n onSubmit = () => {\r\n if(this.state.message != ''){\r\n socket.emit(\"sendmessage\", {\r\n message:this.state.message,\r\n author:this.props.nom,\r\n room:this.state.room\r\n })\r\n this.setState({message:''})\r\n }\r\n }\r\n deleteMessage = (event) =>{\r\n const { value } = event.target;\r\n socket.emit('getMessageToDelete',{\r\n value: value,\r\n room: this.state.room\r\n })\r\n\r\n }\r\n render() {\r\n const BLOCK = {diplay: 'block'}\r\n const NONE= {diplay: 'none'}\r\n if(this.state.change === true){\r\n this.setState({change:false})\r\n return(\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n {this.state.groupetext.map((mess)=>(\r\n
\r\n

{mess.author}

\r\n

{mess.text}

\r\n { this.props.nom == mess.author ? : console.log('')}\r\n
\r\n ))}\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n )\r\n } else{\r\n return (\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n {this.state.groupetext.map((mess)=>(\r\n
\r\n \r\n

{mess.author}

\r\n

{mess.text}

\r\n { this.props.nom == mess.author ? : console.log('')}\r\n
\r\n ))}\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n ); \r\n }\r\n }\r\n }","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\components\\statistique.jsx",["129"],"import React, { Component } from 'react';\r\nimport { Link } from 'react-router-dom';\r\nimport Barregauche from '../barre-gauche.jsx';\r\nimport rockets from '../image/rockets.png'\r\nimport '../style/stastistique.css';\r\n\r\nexport default class StatWithFriend extends Component {\r\n\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n statistique_amis: [{}], \r\n amislist: [{}],\r\n FirstFriend:\"\"\r\n };\r\n }\r\n componentDidMount(){\r\n fetch('http://localhost:4000/app/statByUser', {\r\n method: 'GET',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(response => { \r\n this.setState({statistique_amis:response})\r\n console.log(\"statistique : \",this.state.statistique_amis)\r\n })\r\n fetch('http://localhost:4000/app/friendlist', {\r\n method: 'GET',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(response => {\r\n console.log(response)\r\n this.setState({amislist:response.data})\r\n this.setState({FirstFriend:response.firstFriend})\r\n })\r\n }\r\n\r\n\r\n\r\n render(){\r\n const {statistique_amis} = this.state\r\n return(\r\n
\r\n \r\n
\r\n
\r\n

Nombre de message échanger : Ichat rockets \"amis\"/

\r\n
\r\n
\r\n {statistique_amis.map((amis)=>(\r\n
\r\n

{amis.friend_name} : {amis.nbr_message} \"amis\"/

\r\n
\r\n ))}\r\n
\r\n
\r\n
\r\n );\r\n }\r\n}","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\withAuth.jsx",[],"D:\\matth\\programation\\my-app\\NSI-Projet\\src\\barre-gauche.jsx",["130"]," import React, { Component } from 'react';\r\nimport { Link } from 'react-router-dom';\r\nimport './style/barre-gauche.css';\r\nimport profil from './image/img-profil.jpg'\r\nimport envelope from './image/envelope.png'\r\nimport users from './image/user.png'\r\nimport rouage from './image/settings.png'\r\nimport logout from './image/logout.png'\r\nimport rockets from './image/rockets.png'\r\nimport './style/barre-gauche-responsive.css';\r\n\r\nexport default class barregauche extends Component {\r\n\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n firstFriend:\"\"\r\n };\r\n }\r\n\r\n componentDidMount(){\r\n fetch('http://localhost:4000/app/friendlist', {\r\n method: 'GET',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(response => {\r\n this.setState({firstFriend:response.firstFriend})\r\n })\r\n }\r\n\r\n\r\n \r\n render(){\r\n return(\r\n
\r\n
\r\n
\r\n \"photo\r\n
\r\n
\r\n \r\n \"message\"/\r\n \r\n \r\n \"amis\"/\r\n \r\n \r\n \"statistique\"/\r\n \r\n \r\n \"paramétres\"/\r\n \r\n
\r\n
\r\n \"déconextion\"/\r\n
\r\n
\r\n
\r\n );\r\n }\r\n}\r\n\r\n","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\application2.jsx",["131","132"],"import React, { Component } from 'react';\r\n\r\nimport Chat from './components/chat';\r\nimport { Link } from 'react-router-dom';\r\nimport './style/app.css';\r\nimport './style/app-responsive.css';\r\nimport Barregauche from './barre-gauche.jsx';\r\nimport Barreamisgauche from './barre-amis-gauche';\r\n\r\n\r\nexport default class Application2 extends Component {\r\n \r\n \r\n // création du State \"friend\"\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n friend : '',\r\n message : '',\r\n amislist: [{_id:0, _pseudo:\"\"}],\r\n firstFriend:\"\",\r\n user_nom : ''\r\n };\r\n }\r\n \r\n // ajout des changement lorsque le texte de l'input change\r\n handleInputChange = (event) => {\r\n const { value, name } = event.target;\r\n this.setState({\r\n [name]: value\r\n });\r\n }\r\n\r\n // fonction permettant de faire une requête POST au serveur et d'envoyer les données\r\n onSubmit = (event) => {\r\n event.preventDefault();\r\n console.log(\"state envois demande amis : \",this.state)\r\n // requête POST\r\n fetch('http://localhost:4000/app/newfriend', {\r\n method: 'POST',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n body: JSON.stringify({\r\n new_friend: this.state.friend\r\n }),\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n }\r\n })\r\n // renvois message de réussite ou non\r\n .then(res => {\r\n if (res.status === 200) {\r\n this.setState({message: \"\"})\r\n } else if(res.status === 400){\r\n this.setState({message : \"l'utilisateur rechercher n'existe pas\"})\r\n }\r\n else{\r\n console.log(\"erreur\")\r\n }\r\n })\r\n }\r\n componentDidMount(){\r\n fetch('http://localhost:4000/app/friendlist', {\r\n method: 'GET',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(response => {\r\n //console.log(response)\r\n this.setState({amislist:response.friends})\r\n this.setState({user_nom:response.pseudo})\r\n this.setState({firstFriend:response.firstFriend})\r\n //let test = this.state.amislist\r\n\r\n })\r\n }\r\n\r\n render() {\r\n const {message} = this.state\r\n const { id } = this.props.match.params;\r\n return (\r\n
\r\n
\r\n \r\n \r\n
\r\n \r\n
\r\n ); \r\n }\r\n }","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\components\\paramètre.jsx",["133"],"import React, { Component } from 'react';\r\nimport { Link } from 'react-router-dom';\r\nimport BarreGauche from '../barre-gauche'\r\nimport '../style/paramètre.css';\r\nimport '../style/paramètre-responsive.css';\r\n\r\nexport default class parametre extends Component {\r\n\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n newName:\"\",\r\n message:\"\"\r\n };\r\n }\r\n\r\n handleInputChange = (event) => {\r\n const { value, name } = event.target;\r\n this.setState({\r\n [name]: value\r\n });\r\n }\r\n \r\n onSubmit = (event)=>{\r\n event.preventDefault();\r\n console.log(this.state)\r\n fetch('http://localhost:4000/app/changeName', {\r\n method: 'POST',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n body: JSON.stringify({\r\n newName:this.state.newName\r\n }),\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n }\r\n })\r\n .then(res => {\r\n if (res.status === 200) {\r\n // s'il y a aucune erreur, renvoyer vers l'acceuil\r\n this.setState({message:'Le Changement de pseudo a bien été effectué'});\r\n console.log(\"OK\")\r\n }if (res.status === 401){\r\n // si erreur code est 401, renvoyer ce message\r\n this.setState({message:'Erreur'});\r\n } \r\n })\r\n this.setState({newName:\"\"})\r\n }\r\n render(){\r\n return(\r\n
\r\n \r\n
\r\n
\r\n

Changer ici votre mots de passe :

\r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n

{this.state.message}

\r\n
\r\n
\r\n
\r\n );\r\n }\r\n}","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\components\\friend_nom.jsx",["134"],"import React, { Component } from 'react';\r\n\r\n\r\nexport default class friend_nom extends Component {\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n nom:'',\r\n id:''\r\n };\r\n }\r\n componentDidMount(){\r\n fetch('http://localhost:4000/app/getFriendName', {\r\n method: 'POST',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n body: JSON.stringify({\r\n name: this.props.id\r\n }),\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(response => {\r\n this.setState({nom:response})\r\n this.setState({id:this.props.id})\r\n })\r\n }\r\n componentDidUpdate(){\r\n if(this.state.id != this.props.id){\r\n fetch('http://localhost:4000/app/getFriendName', {\r\n method: 'POST',\r\n // credentials : include permet d'intégrer les cookie avec la requête\r\n credentials: 'include', \r\n body: JSON.stringify({\r\n name: this.props.id\r\n }),\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(response => {\r\n this.setState({nom:response})\r\n this.setState({id:this.props.id})\r\n })\r\n }\r\n }\r\n render(){\r\n return(\r\n

\r\n {this.state.nom}\r\n

\r\n\r\n );\r\n }\r\n}","D:\\matth\\programation\\my-app\\NSI-Projet\\src\\barre-amis-gauche.jsx",[],{"ruleId":"135","replacedBy":"136"},{"ruleId":"137","replacedBy":"138"},{"ruleId":"139","severity":1,"message":"140","line":2,"column":32,"nodeType":"141","messageId":"142","endLine":2,"endColumn":38},{"ruleId":"139","severity":1,"message":"143","line":2,"column":40,"nodeType":"141","messageId":"142","endLine":2,"endColumn":44},{"ruleId":"139","severity":1,"message":"144","line":10,"column":8,"nodeType":"141","messageId":"142","endLine":10,"endColumn":12},{"ruleId":"139","severity":1,"message":"145","line":15,"column":10,"nodeType":"141","messageId":"142","endLine":15,"endColumn":23},{"ruleId":"139","severity":1,"message":"146","line":15,"column":25,"nodeType":"141","messageId":"142","endLine":15,"endColumn":30},{"ruleId":"139","severity":1,"message":"140","line":15,"column":32,"nodeType":"141","messageId":"142","endLine":15,"endColumn":38},{"ruleId":"139","severity":1,"message":"147","line":15,"column":46,"nodeType":"141","messageId":"142","endLine":15,"endColumn":52},{"ruleId":"148","severity":1,"message":"149","line":30,"column":17,"nodeType":"150","endLine":30,"endColumn":32},{"ruleId":"148","severity":1,"message":"149","line":31,"column":17,"nodeType":"150","endLine":31,"endColumn":32},{"ruleId":"148","severity":1,"message":"149","line":32,"column":17,"nodeType":"150","endLine":32,"endColumn":32},{"ruleId":"148","severity":1,"message":"149","line":43,"column":17,"nodeType":"150","endLine":43,"endColumn":49},{"ruleId":"151","severity":1,"message":"152","line":67,"column":17,"nodeType":"150","endLine":67,"endColumn":91},{"ruleId":"151","severity":1,"message":"152","line":96,"column":17,"nodeType":"150","endLine":96,"endColumn":94},{"ruleId":"151","severity":1,"message":"152","line":108,"column":17,"nodeType":"150","endLine":108,"endColumn":86},{"ruleId":"151","severity":1,"message":"152","line":112,"column":29,"nodeType":"150","endLine":112,"endColumn":108},{"ruleId":"151","severity":1,"message":"152","line":117,"column":29,"nodeType":"150","endLine":117,"endColumn":92},{"ruleId":"151","severity":1,"message":"152","line":122,"column":29,"nodeType":"150","endLine":122,"endColumn":106},{"ruleId":"151","severity":1,"message":"152","line":127,"column":29,"nodeType":"150","endLine":127,"endColumn":92},{"ruleId":"151","severity":1,"message":"152","line":132,"column":29,"nodeType":"150","endLine":132,"endColumn":98},{"ruleId":"151","severity":1,"message":"152","line":137,"column":29,"nodeType":"150","endLine":137,"endColumn":92},{"ruleId":"151","severity":1,"message":"152","line":143,"column":29,"nodeType":"150","endLine":143,"endColumn":100},{"ruleId":"151","severity":1,"message":"152","line":148,"column":29,"nodeType":"150","endLine":148,"endColumn":92},{"ruleId":"153","severity":1,"message":"154","line":164,"column":9,"nodeType":"150","endLine":164,"endColumn":108},{"ruleId":"151","severity":1,"message":"152","line":185,"column":21,"nodeType":"150","endLine":185,"endColumn":91},{"ruleId":"151","severity":1,"message":"152","line":190,"column":21,"nodeType":"150","endLine":190,"endColumn":93},{"ruleId":"151","severity":1,"message":"152","line":194,"column":21,"nodeType":"150","endLine":194,"endColumn":101},{"ruleId":"151","severity":1,"message":"152","line":204,"column":17,"nodeType":"150","endLine":204,"endColumn":91},{"ruleId":"151","severity":1,"message":"152","line":332,"column":17,"nodeType":"150","endLine":332,"endColumn":96},{"ruleId":"139","severity":1,"message":"155","line":2,"column":8,"nodeType":"141","messageId":"142","endLine":2,"endColumn":13},{"ruleId":"139","severity":1,"message":"145","line":3,"column":10,"nodeType":"141","messageId":"142","endLine":3,"endColumn":23},{"ruleId":"139","severity":1,"message":"146","line":3,"column":25,"nodeType":"141","messageId":"142","endLine":3,"endColumn":30},{"ruleId":"139","severity":1,"message":"140","line":3,"column":32,"nodeType":"141","messageId":"142","endLine":3,"endColumn":38},{"ruleId":"139","severity":1,"message":"147","line":3,"column":46,"nodeType":"141","messageId":"142","endLine":3,"endColumn":52},{"ruleId":"139","severity":1,"message":"155","line":2,"column":8,"nodeType":"141","messageId":"142","endLine":2,"endColumn":13},{"ruleId":"139","severity":1,"message":"145","line":3,"column":10,"nodeType":"141","messageId":"142","endLine":3,"endColumn":23},{"ruleId":"139","severity":1,"message":"146","line":3,"column":25,"nodeType":"141","messageId":"142","endLine":3,"endColumn":30},{"ruleId":"139","severity":1,"message":"140","line":3,"column":32,"nodeType":"141","messageId":"142","endLine":3,"endColumn":38},{"ruleId":"139","severity":1,"message":"147","line":3,"column":46,"nodeType":"141","messageId":"142","endLine":3,"endColumn":52},{"ruleId":"139","severity":1,"message":"145","line":2,"column":10,"nodeType":"141","messageId":"142","endLine":2,"endColumn":23},{"ruleId":"139","severity":1,"message":"146","line":2,"column":25,"nodeType":"141","messageId":"142","endLine":2,"endColumn":30},{"ruleId":"139","severity":1,"message":"140","line":2,"column":32,"nodeType":"141","messageId":"142","endLine":2,"endColumn":38},{"ruleId":"139","severity":1,"message":"147","line":2,"column":46,"nodeType":"141","messageId":"142","endLine":2,"endColumn":52},{"ruleId":"139","severity":1,"message":"144","line":3,"column":8,"nodeType":"141","messageId":"142","endLine":3,"endColumn":12},{"ruleId":"139","severity":1,"message":"156","line":4,"column":10,"nodeType":"141","messageId":"142","endLine":4,"endColumn":20},{"ruleId":"139","severity":1,"message":"157","line":6,"column":8,"nodeType":"141","messageId":"142","endLine":6,"endColumn":22},{"ruleId":"139","severity":1,"message":"156","line":4,"column":10,"nodeType":"141","messageId":"142","endLine":4,"endColumn":20},{"ruleId":"158","severity":1,"message":"159","line":81,"column":7,"nodeType":"160","messageId":"161","endLine":102,"endColumn":8},{"ruleId":"162","severity":1,"message":"163","line":94,"column":20,"nodeType":"164","messageId":"161","endLine":94,"endColumn":22},{"ruleId":"162","severity":1,"message":"163","line":104,"column":31,"nodeType":"164","messageId":"161","endLine":104,"endColumn":33},{"ruleId":"139","severity":1,"message":"165","line":122,"column":13,"nodeType":"141","messageId":"142","endLine":122,"endColumn":18},{"ruleId":"139","severity":1,"message":"166","line":123,"column":13,"nodeType":"141","messageId":"142","endLine":123,"endColumn":17},{"ruleId":"162","severity":1,"message":"167","line":138,"column":36,"nodeType":"164","messageId":"161","endLine":138,"endColumn":38},{"ruleId":"168","severity":1,"message":"169","line":138,"column":108,"nodeType":"150","endLine":138,"endColumn":127},{"ruleId":"162","severity":1,"message":"167","line":174,"column":36,"nodeType":"164","messageId":"161","endLine":174,"endColumn":38},{"ruleId":"139","severity":1,"message":"143","line":2,"column":10,"nodeType":"141","messageId":"142","endLine":2,"endColumn":14},{"ruleId":"151","severity":1,"message":"152","line":44,"column":25,"nodeType":"150","endLine":44,"endColumn":86},{"ruleId":"139","severity":1,"message":"143","line":4,"column":10,"nodeType":"141","messageId":"142","endLine":4,"endColumn":14},{"ruleId":"139","severity":1,"message":"170","line":84,"column":14,"nodeType":"141","messageId":"142","endLine":84,"endColumn":21},{"ruleId":"139","severity":1,"message":"143","line":2,"column":10,"nodeType":"141","messageId":"142","endLine":2,"endColumn":14},{"ruleId":"162","severity":1,"message":"163","line":32,"column":26,"nodeType":"164","messageId":"161","endLine":32,"endColumn":28},"no-native-reassign",["171"],"no-negated-in-lhs",["172"],"no-unused-vars","'Router' is defined but never used.","Identifier","unusedVar","'Link' is defined but never used.","'Chat' is defined but never used.","'BrowserRouter' is defined but never used.","'Route' is defined but never used.","'Switch' is defined but never used.","jsx-a11y/anchor-is-valid","The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md","JSXOpeningElement","jsx-a11y/img-redundant-alt","Redundant alt attribute. Screen-readers already announce `img` tags as an image. You don’t need to use the words `image`, `photo,` or `picture` (or any specified custom words) in the alt prop.","jsx-a11y/iframe-has-title","