diff --git a/frontend/src/api/constants.ts b/frontend/src/api/constants.ts index 85b0fe785f..2563625a79 100644 --- a/frontend/src/api/constants.ts +++ b/frontend/src/api/constants.ts @@ -37,6 +37,7 @@ export enum HttpStatusCode { export enum RtkCacheTagType { PriorNotification = 'PriorNotification', PriorNotificationDocuments = 'PriorNotificationDocuments', + PriorNotificationSentMessages = 'PriorNotificationSentMessages', PriorNotificationTypes = 'PriorNotificationTypes', PriorNotifications = 'PriorNotifications', PriorNotificationsToVerify = 'PriorNotificationsToVerify', diff --git a/frontend/src/features/PriorNotification/PriorNotification.types.ts b/frontend/src/features/PriorNotification/PriorNotification.types.ts index 126c0073b3..197d1f2c6a 100644 --- a/frontend/src/features/PriorNotification/PriorNotification.types.ts +++ b/frontend/src/features/PriorNotification/PriorNotification.types.ts @@ -159,6 +159,14 @@ export namespace PriorNotification { name: string } + export type SentMessage = { + communicationMeans: 'EMAIL' | 'FAX' | 'SMS' + dateTimeUtc: string + errorMessage: string | undefined + recipientAddressOrNumber: string + success: boolean + } + export type Upload = { createdAt: string fileName: string diff --git a/frontend/src/features/PriorNotification/priorNotificationApi.ts b/frontend/src/features/PriorNotification/priorNotificationApi.ts index 5223d833ce..444489c8d0 100644 --- a/frontend/src/features/PriorNotification/priorNotificationApi.ts +++ b/frontend/src/features/PriorNotification/priorNotificationApi.ts @@ -16,6 +16,8 @@ const CREATE_PRIOR_NOTIFICATION_ERROR_MESSAGE = "Nous n'avons pas pu créé le p const DELETE_PRIOR_NOTIFICATION_UPLOAD_ERROR_MESSAGE = "Nous n'avons pas pu supprimer ce document attaché." const GET_PRIOR_NOTIFICATION_UPLOADS_ERROR_MESSAGE = "Nous n'avons pas pu récupérer les documents attachés à ce préavis." +const GET_PRIOR_NOTIFICATION_SENT_MESSAGES_ERROR_MESSAGE = + "Nous n'avons pas pu récupérer la liste des envois correspondant à ce préavis." const UPDATE_PRIOR_NOTIFICATION_ERROR_MESSAGE = "Nous n'avons pas pu modifier le préavis." const GET_PRIOR_NOTIFICATION_DETAIL_ERROR_MESSAGE = "Nous n'avons pas pu récupérer le préavis." const GET_PRIOR_NOTIFICATIONS_ERROR_MESSAGE = "Nous n'avons pas pu récupérer la liste des préavis." @@ -128,6 +130,13 @@ export const priorNotificationApi = monitorfishApi.injectEndpoints({ transformErrorResponse: response => new FrontendApiError(GET_PRIOR_NOTIFICATIONS_ERROR_MESSAGE, response) }), + getPriorNotificationSentNessages: builder.query({ + providesTags: () => [{ type: RtkCacheTagType.PriorNotificationSentMessages }], + query: reportId => `/prior_notifications/${reportId}/sent_messages`, + transformErrorResponse: response => + new FrontendApiError(GET_PRIOR_NOTIFICATION_SENT_MESSAGES_ERROR_MESSAGE, response) + }), + getPriorNotificationsToVerify: builder.query({ providesTags: () => [{ type: RtkCacheTagType.PriorNotificationsToVerify }], query: () => '/prior_notifications/to_verify',