[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';
|
import { logout } from '../api/authentication';
|
||||||
|
|
||||||
function useClientInfos() {
|
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;
|
let clientInfos = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Try to parse the cookie into a JavaScript object
|
// Try to parse the cookie into a JavaScript object
|
||||||
clientInfos = cookies['client-infos'].split(',');
|
clientInfos = cookies['client-infos'].split(',');
|
||||||
|
|
||||||
|
return {
|
||||||
|
nickname: clientInfos[0],
|
||||||
|
role: clientInfos[1]
|
||||||
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing client-infos cookie:', error);
|
console.error('Error parsing client-infos cookie:', error);
|
||||||
logout();
|
logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
|
||||||
nickname: clientInfos[0],
|
|
||||||
role: clientInfos[1]
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "cosmos-server",
|
"name": "cosmos-server",
|
||||||
"version": "0.10.0-unstable29",
|
"version": "0.10.0-unstable30",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "test-server.js",
|
"main": "test-server.js",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|
Loading…
Reference in a new issue