[release] v0.10.0-unstable30
This commit is contained in:
parent
dd61551566
commit
c779d47537
|
@ -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 {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.10.0-unstable29",
|
||||
"version": "0.10.0-unstable30",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
|
Loading…
Reference in a new issue