frontend/app/auth/Account.ts

20 lines
460 B
TypeScript

import {jwtDecode} from "jwt-decode";
export class Account
{
id?: string;
firstname?: string;
lastname?: string;
email?: string;
}
export function getAccount()
{
const payload = jwtDecode(useCookie<string>("identity").value) as any;
const account = new Account();
account.id = payload.upn;
account.email = payload.email;
account.lastname = payload.lastname;
account.firstname = payload.firstname;
return account;
}