Skip to content

Commit

Permalink
fix(frontend): fix some backend urls
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryJobst committed Nov 10, 2024
1 parent 8315555 commit 124d741
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions frontend/src/features/event/services/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export class EventService extends GenericService<SportEvent> {
if (response) {
const result = response
result.content = result.content.map((element) => {
if (element.startTime)
element.startTime = new Date(element.startTime)
if (element.startTime) element.startTime = new Date(element.startTime)

return element
})
Expand All @@ -43,7 +42,7 @@ export class EventService extends GenericService<SportEvent> {
static async calculate(result_list_id: number, t: (key: string) => string) {
return axiosInstance
.put(`${resultListUrl}/${result_list_id}/calculate`)
.then(response => response.data)
.then((response) => response.data)
.catch((error) => {
handleApiError(error, t)
return null
Expand All @@ -53,7 +52,7 @@ export class EventService extends GenericService<SportEvent> {
static async getEventStatus(t: (key: string) => string): Promise<EventStatus[] | null> {
return await axiosInstance
.get<EventStatus[]>(eventStatusUrl)
.then(response => response.data)
.then((response) => response.data)
.catch((error) => {
handleApiError(error, t)
return null
Expand All @@ -71,12 +70,12 @@ export class EventService extends GenericService<SportEvent> {
response.data.resultLists = response.data.resultLists.map(
(resultList: ResultList) => {
if (
resultList.createTime
&& typeof resultList.createTime === 'string'
resultList.createTime &&
typeof resultList.createTime === 'string'
) {
// Entfernen des Zeitzone-Identifikators, da dieser nicht von Date.parse() unterstützt wird
const dateStringWithoutTimezone
= resultList.createTime.split('[')[0]
const dateStringWithoutTimezone =
resultList.createTime.split('[')[0]
resultList.createTime = new Date(dateStringWithoutTimezone)
}
return resultList
Expand All @@ -99,7 +98,7 @@ export class EventService extends GenericService<SportEvent> {
'Content-Type': 'multipart/form-data',
},
})
.then(response => response.data)
.then((response) => response.data)
.catch((error) => {
handleApiError(error, t)
return null
Expand Down Expand Up @@ -148,11 +147,10 @@ export class EventService extends GenericService<SportEvent> {
}

static async getCertificate(certificate: Certificate | undefined, t: (key: string) => string) {
if (!certificate || !certificate.event)
return null
if (!certificate || !certificate.event) return null

return axiosInstance
.put(`/event/${certificate.event?.id}/certificate`, certificate, {
.put(`${eventUrl}/${certificate.event?.id}/certificate`, certificate, {
responseType: 'blob',
})
.then((response) => {
Expand All @@ -174,20 +172,19 @@ export class EventService extends GenericService<SportEvent> {
return null
}
return axiosInstance
.get(`/${eventUrl}/${id}/certificate_stats`)
.then(response => response.data)
.get(`${eventUrl}/${id}/certificate_stats`)
.then((response) => response.data)
.catch((error) => {
handleApiError(error, t)
return null
})
}

static async removeEventCertificateStat(id: number, t: (key: string) => string) {
if (!id)
return null
if (!id) return null
return axiosInstance
.delete(`/event_certificate_stat/${id}`)
.then(response => response.data)
.then((response) => response.data)
.catch((error) => {
handleApiError(error, t)
return null
Expand All @@ -197,7 +194,7 @@ export class EventService extends GenericService<SportEvent> {
static async getCertificateSchema(t: (key: string) => string) {
return axiosInstance
.get('/certificate_schema')
.then(response => response.data)
.then((response) => response.data)
.catch((error) => {
handleApiError(error, t)
return null
Expand All @@ -213,7 +210,7 @@ export class EventService extends GenericService<SportEvent> {
}
return axiosInstance
.get(`${resultListUrl}/${id}/cup_score_lists`)
.then(response => response.data)
.then((response) => response.data)
.catch((error) => {
handleApiError(error, t)
return null
Expand Down

0 comments on commit 124d741

Please sign in to comment.