improve error handling for 401 requests and fetch

This commit is contained in:
Gregor Vostrak
2024-06-01 00:12:03 +02:00
parent a64ee87d19
commit bae4265f70
13 changed files with 305 additions and 249 deletions

View File

@@ -39,12 +39,13 @@ export const useReportingStore = defineStore('reporting', () => {
const organization = getCurrentOrganizationId();
if (organization) {
reportingGraphResponse.value = await handleApiRequestNotifications(
api.getAggregatedTimeEntries({
params: {
organization: organization,
},
queries: params,
}),
() =>
api.getAggregatedTimeEntries({
params: {
organization: organization,
},
queries: params,
}),
undefined,
'Failed to fetch reporting data'
);
@@ -57,12 +58,13 @@ export const useReportingStore = defineStore('reporting', () => {
const organization = getCurrentOrganizationId();
if (organization) {
reportingTableResponse.value = await handleApiRequestNotifications(
api.getAggregatedTimeEntries({
params: {
organization: organization,
},
queries: params,
}),
() =>
api.getAggregatedTimeEntries({
params: {
organization: organization,
},
queries: params,
}),
undefined,
'Failed to fetch reporting data'
);