mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-16 20:22:15 +01:00
add basic crud frontend for clients, tags and projects
This commit is contained in:
26
resources/js/utils/useMembers.ts
Normal file
26
resources/js/utils/useMembers.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { api } from '../../../openapi.json.client';
|
||||
import { computed, ref } from 'vue';
|
||||
import type { Member, MemberIndexResponse } from '@/utils/api';
|
||||
import { getCurrentOrganizationId } from '@/utils/useUser';
|
||||
|
||||
export const useMembersStore = defineStore('members', () => {
|
||||
const membersResponse = ref<MemberIndexResponse | null>(null);
|
||||
|
||||
async function fetchMembers() {
|
||||
const organization = getCurrentOrganizationId();
|
||||
if (organization) {
|
||||
membersResponse.value = await api.getMembers({
|
||||
params: {
|
||||
organization: organization,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const members = computed<Member[]>(() => {
|
||||
return membersResponse.value?.data || [];
|
||||
});
|
||||
|
||||
return { members, fetchMembers };
|
||||
});
|
||||
Reference in New Issue
Block a user