function setSession(session) {
  localStorage.setItem("auth_token", session.token);
  localStorage.setItem("user_permissions", JSON.stringify(session.user.permissions));
}

function getPermissions() {
  try {
    return JSON.parse(localStorage.getItem("user_permissions")) || [];
  } catch {
    return [];
  }
}
