Skip to content

Commit

Permalink
fix: trim announcement text fields (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
goemen authored Sep 24, 2024
1 parent a12f024 commit f371a9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions admin-frontend/src/services/__tests__/apiService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions admin-frontend/src/services/apiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand All @@ -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) {
Expand Down

0 comments on commit f371a9c

Please sign in to comment.