import { userState } from '$lib/shared.svelte'; export const getCookieValue = (name: String) => document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || ''; export function updateUserState() { const JWT = getCookieValue('jwt'); if (JWT !== '') { const state = JSON.parse(atob(JWT.split('.')[1])); userState.perms = state.perms; userState.username = state.username; userState.id = state.id; } }