[release] v0.10.0-unstable30

This commit is contained in:
Yann Stepienik 2023-10-07 14:37:40 +01:00
parent dd61551566
commit c779d47537
2 changed files with 15 additions and 7 deletions

View file

@ -3,22 +3,30 @@ import { useCookies } from 'react-cookie';
import { logout } from '../api/authentication';
function useClientInfos() {
const [cookies] = useCookies(['client-infos']);
const [cookies] = useCookies(['client-infos', 'jwttoken']);
if(cookies['jwttoken'] === undefined) {
// probably the demo or new install
return {
nickname: "",
role: "2"
}
}
let clientInfos = null;
try {
// Try to parse the cookie into a JavaScript object
clientInfos = cookies['client-infos'].split(',');
return {
nickname: clientInfos[0],
role: clientInfos[1]
};
} catch (error) {
console.error('Error parsing client-infos cookie:', error);
logout();
}
return {
nickname: clientInfos[0],
role: clientInfos[1]
};
}
export {

View file

@ -1,6 +1,6 @@
{
"name": "cosmos-server",
"version": "0.10.0-unstable29",
"version": "0.10.0-unstable30",
"description": "",
"main": "test-server.js",
"bugs": {