diff --git a/.env b/.env index aae0c767..4b96a475 100644 --- a/.env +++ b/.env @@ -14,9 +14,9 @@ NGINX_ENVSUBST_TEMPLATE_SUFFIX=".conf" # BASE_URL=http://localhost -BASE_URL=localhost -REACT_APP_BASE_URL=localhost -REDIRECT_URI=http://localhost/api/auth/login +BASE_URL=92.143.191.152 +REACT_APP_BASE_URL=92.143.191.152 +REDIRECT_URI=http://92.143.191.152/api/auth/login #postgres var # POSTGRES_HOST=127.0.0.1 # DB_TYPE=postgres diff --git a/containers/api/src/app.controller.ts b/containers/api/src/app.controller.ts index 9183cb2b..477ccdd0 100644 --- a/containers/api/src/app.controller.ts +++ b/containers/api/src/app.controller.ts @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/17 01:00:00 by apommier #+# #+# */ -/* Updated: 2023/06/18 13:30:50 by apommier ### ########.fr */ +/* Updated: 2023/06/18 17:45:39 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -419,6 +419,8 @@ export class AppController { if (!amIhere) data.members.push(req.user.username) // let test = {id: 2, members: "cc"}; + data.admin = [] + data.admin.push(req.user.username) data.owner = req.user.username data.group = true; return await this.chatService.createConv(data); diff --git a/containers/react/.env b/containers/react/.env index 3b0e2b83..07066191 100644 --- a/containers/react/.env +++ b/containers/react/.env @@ -1,2 +1,3 @@ -REACT_APP_BASE_URL=localhost +# REACT_APP_BASE_URL=localhost +REACT_APP_BASE_URL=92.143.191.152 # REACT_APP_BASE_URL=192.168.1.19 \ No newline at end of file diff --git a/containers/react/src/components/Messages/Modal.tsx b/containers/react/src/components/Messages/Modal.tsx index 62b50811..deda5cae 100644 --- a/containers/react/src/components/Messages/Modal.tsx +++ b/containers/react/src/components/Messages/Modal.tsx @@ -77,7 +77,7 @@ const Modal = ({handleClose}) => { } }; - const saveSelectedOptions = () => { + const saveSelectedOptions = async () => { // const selectedOptions = selectTags.map((tag) => tag.selectedOption); const selectedOptions = selectTags.map((tag) => tag.selectedOption).filter((option) => option !== ''); @@ -88,8 +88,9 @@ const Modal = ({handleClose}) => { } try{ // test - api.post("/conv", data); + await api.post("/conv", data); handleClose(); + window.location.reload(false); } catch(err) { console.log(err); } diff --git a/containers/react/src/pages/Login42.tsx b/containers/react/src/pages/Login42.tsx index 4d8ae2e2..c3bfbc8f 100644 --- a/containers/react/src/pages/Login42.tsx +++ b/containers/react/src/pages/Login42.tsx @@ -18,7 +18,7 @@ function Login42() client_id: 'u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41', client_secret: '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', code: code, - redirect_uri: 'http://localhost:8080/login42', + redirect_uri: 'http://' + process.env.REACT_APP_BASE_URL + '/login42', }; axios.post('https://api.intra.42.fr/oauth/token', data)