add time overview page

This commit is contained in:
Gregor Vostrak
2024-03-26 18:19:08 +01:00
parent ab9a1d2fab
commit 26fef8b9f7
52 changed files with 2463 additions and 972 deletions

View File

@@ -1,24 +1,26 @@
import { defineStore } from 'pinia';
import { api } from '../../../openapi.json.client';
import { computed, ref } from 'vue';
import type { ZodiosResponseByAlias } from '@zodios/core';
import type { SolidTimeApi } from '@/utils/api';
type ProjectResponse = ZodiosResponseByAlias<SolidTimeApi, 'getProjects'>;
export type Project = ProjectResponse['data'][0];
import type { Project, ProjectResponse } from '@/utils/api';
import { getCurrentOrganizationId } from '@/utils/useUser';
export const useProjectsStore = defineStore('projects', () => {
const projectResponse = ref<ProjectResponse | null>(null);
async function fetchProjects(organizationId: string) {
projectResponse.value = await api.getProjects({
params: {
organization: organizationId,
},
});
async function fetchProjects() {
const organization = getCurrentOrganizationId();
if (organization) {
projectResponse.value = await api.getProjects({
params: {
organization: organization,
},
});
}
}
const projects = computed(() => projectResponse.value?.data || []);
const projects = computed<Project[]>(
() => projectResponse.value?.data || []
);
return { projects, fetchProjects };
});