diff --git a/admin-frontend/src/services/__tests__/apiService.spec.ts b/admin-frontend/src/services/__tests__/apiService.spec.ts index 4539bd33..5f4a0aca 100644 --- a/admin-frontend/src/services/__tests__/apiService.spec.ts +++ b/admin-frontend/src/services/__tests__/apiService.spec.ts @@ -455,7 +455,7 @@ describe('ApiService', () => { it('returns a promise that eventually resolves', async () => { const payload: any = { title: 'test', - describe: 'test', + description: 'test', status: 'PUBLISHED', expires_on: '2021-12-31', active_on: '2021-12-31', @@ -498,7 +498,7 @@ describe('ApiService', () => { describe('updateAnnouncements', () => { describe('when the API request to the backend is successful', () => { it('returns a promise that eventually resolves', async () => { - const payload: any = { title: 'test' }; + const payload: any = { title: 'test', description: 'test' }; const mockResponse = { data: {}, status: 201, diff --git a/admin-frontend/src/services/apiService.ts b/admin-frontend/src/services/apiService.ts index 59cb1567..69273874 100644 --- a/admin-frontend/src/services/apiService.ts +++ b/admin-frontend/src/services/apiService.ts @@ -519,8 +519,8 @@ export default { const buildFormData = (data: AnnouncementFormValue) => { const formData = new FormData(); - formData.append('title', data.title); - formData.append('description', data.description); + formData.append('title', data.title.trim()); + formData.append('description', data.description.trim()); formData.append('status', data.status); if (data.active_on) { formData.append('active_on', data.active_on); @@ -529,7 +529,7 @@ const buildFormData = (data: AnnouncementFormValue) => { formData.append('expires_on', data.expires_on); } if (data.linkUrl && data.linkDisplayName) { - formData.append('linkUrl', data.linkUrl); + formData.append('linkUrl', data.linkUrl.trim()); formData.append('linkDisplayName', data.linkDisplayName); } @@ -538,7 +538,7 @@ const buildFormData = (data: AnnouncementFormValue) => { } if (data.fileDisplayName) { - formData.append('fileDisplayName', data.fileDisplayName); + formData.append('fileDisplayName', data.fileDisplayName.trim()); } if (data.attachmentId) {