mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-05-07 20:32:26 +00:00
38 lines
827 B
TypeScript
38 lines
827 B
TypeScript
import { usePage } from '@inertiajs/vue3';
|
|
import type { User } from '@/types/models';
|
|
|
|
const page = usePage<{
|
|
auth: {
|
|
user: User;
|
|
};
|
|
}>();
|
|
function getCurrentUserId() {
|
|
return page.props.auth.user.id;
|
|
}
|
|
|
|
function getCurrentUser() {
|
|
return page.props.auth.user;
|
|
}
|
|
|
|
function getCurrentOrganizationId() {
|
|
return page.props.auth.user.current_team_id;
|
|
}
|
|
|
|
function getCurrentMembershipId() {
|
|
return page.props.auth.user.all_teams.find((team) => team.id === getCurrentOrganizationId())
|
|
?.membership.id;
|
|
}
|
|
|
|
function getCurrentRole() {
|
|
return page.props.auth.user.all_teams.find((team) => team.id === getCurrentOrganizationId())
|
|
?.membership.role;
|
|
}
|
|
|
|
export {
|
|
getCurrentOrganizationId,
|
|
getCurrentUserId,
|
|
getCurrentMembershipId,
|
|
getCurrentRole,
|
|
getCurrentUser,
|
|
};
|