From ba72f590cb0b3f6ba357f69476ca3c7a6e3f473c Mon Sep 17 00:00:00 2001 From: Marius Tobiassen Bungum Date: Fri, 20 Dec 2024 07:27:39 +0100 Subject: [PATCH] :alien: Using latest published release notes endpoint --- src/api/services/ReleaseNotesService.ts | 19 ++++++++++++++++++- src/hooks/useReleaseNotesQuery.ts | 7 +++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/api/services/ReleaseNotesService.ts b/src/api/services/ReleaseNotesService.ts index 0f62d56..a358e11 100644 --- a/src/api/services/ReleaseNotesService.ts +++ b/src/api/services/ReleaseNotesService.ts @@ -2,7 +2,7 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { CancelablePromise } from 'src/api'; +import type { CancelablePromise, ReleaseNote } from 'src/api'; import { OpenAPI_SAM } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class ReleaseNotesService { @@ -94,4 +94,21 @@ export class ReleaseNotesService { }, }); } + /** + * Get published release notes + * @param applicationName + * @returns ReleaseNote OK + * @throws ApiError + */ + public static getPublishedReleasenotes( + applicationName: string + ): CancelablePromise> { + return __request(OpenAPI_SAM, { + method: 'GET', + url: '/api/v1/ReleaseNotes/{applicationName}', + path: { + applicationName: applicationName, + }, + }); + } } diff --git a/src/hooks/useReleaseNotesQuery.ts b/src/hooks/useReleaseNotesQuery.ts index 3d2c4f5..c86e78c 100644 --- a/src/hooks/useReleaseNotesQuery.ts +++ b/src/hooks/useReleaseNotesQuery.ts @@ -1,6 +1,5 @@ import { useQuery } from '@tanstack/react-query'; -import { ReleaseNote } from 'src/api/models/ReleaseNote'; import { ReleaseNotesService } from 'src/api/services/ReleaseNotesService'; import { GET_RELEASE_NOTES } from 'src/constants/queryKeys'; import { environment } from 'src/utils'; @@ -16,10 +15,10 @@ export function useReleaseNotesQuery(options?: ReleaseNotesQueryProps) { const applicationName = options?.overrideAppName ?? getAppName(import.meta.env.VITE_NAME); - return useQuery({ + return useQuery({ queryKey: [GET_RELEASE_NOTES], - // TODO: Change this endpoint to the one that doesn't return draft notes - queryFn: () => ReleaseNotesService.getReleasenoteList(applicationName), + queryFn: () => + ReleaseNotesService.getPublishedReleasenotes(applicationName), enabled: options?.enabled ?? true, }); }