schlechtenburg/packages/example-site/composables/me.ts

32 lines
480 B
TypeScript

export interface IRole {
id?: string|null;
attributes?: {
description: string;
name: string;
};
}
export interface IUser {
id?: string|null;
attributes?: {
blocked?: boolean;
confirmed?: boolean;
email?: string;
role?: IRole;
username?: string;
};
}
export const useMe = () => {
const me = useState<IUser|null>('me', () => null);
const setMe = (user: IUser|null) => {
me.value = user;
};
return {
me,
setMe,
};
};