mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-13 02:32:15 +01:00
refactor timetracker to seperate data and ui logic
This commit is contained in:
@@ -37,7 +37,7 @@ export const useProjectsStore = defineStore('projects', () => {
|
||||
async function createProject(projectBody: CreateProjectBody) {
|
||||
const organization = getCurrentOrganizationId();
|
||||
if (organization) {
|
||||
await handleApiRequestNotifications(
|
||||
const response = await handleApiRequestNotifications(
|
||||
() =>
|
||||
api.createProject(projectBody, {
|
||||
params: {
|
||||
@@ -49,6 +49,7 @@ export const useProjectsStore = defineStore('projects', () => {
|
||||
);
|
||||
|
||||
await fetchProjects();
|
||||
return response['data'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,15 +58,12 @@ export const useProjectsStore = defineStore('projects', () => {
|
||||
if (organizationId) {
|
||||
await handleApiRequestNotifications(
|
||||
() =>
|
||||
api.deleteProject(
|
||||
{},
|
||||
{
|
||||
params: {
|
||||
organization: organizationId,
|
||||
project: projectId,
|
||||
},
|
||||
}
|
||||
),
|
||||
api.deleteProject(undefined, {
|
||||
params: {
|
||||
organization: organizationId,
|
||||
project: projectId,
|
||||
},
|
||||
}),
|
||||
'Project deleted successfully',
|
||||
'Failed to delete project'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user