Skip to content

Commit

Permalink
👽 Using latest published release notes endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mariush2 committed Dec 20, 2024
1 parent fc16e6b commit ba72f59
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
19 changes: 18 additions & 1 deletion src/api/services/ReleaseNotesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -94,4 +94,21 @@ export class ReleaseNotesService {
},
});
}
/**
* Get published release notes
* @param applicationName
* @returns ReleaseNote OK
* @throws ApiError
*/
public static getPublishedReleasenotes(
applicationName: string
): CancelablePromise<Array<ReleaseNote>> {
return __request(OpenAPI_SAM, {
method: 'GET',
url: '/api/v1/ReleaseNotes/{applicationName}',
path: {
applicationName: applicationName,
},
});
}
}
7 changes: 3 additions & 4 deletions src/hooks/useReleaseNotesQuery.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -16,10 +15,10 @@ export function useReleaseNotesQuery(options?: ReleaseNotesQueryProps) {
const applicationName =
options?.overrideAppName ?? getAppName(import.meta.env.VITE_NAME);

return useQuery<ReleaseNote[]>({
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,
});
}

0 comments on commit ba72f59

Please sign in to comment.