reload when create conv

This commit is contained in:
kinou-p 2023-06-18 21:43:19 +02:00
parent e97cacebd5
commit 3ca457a380
5 changed files with 12 additions and 8 deletions

6
.env
View File

@ -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

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);

View File

@ -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

View File

@ -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);
}

View File

@ -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)