diff --git a/front/src/api/announcement/types.ts b/front/src/api/announcement/types.ts index 945477f..449fc6f 100644 --- a/front/src/api/announcement/types.ts +++ b/front/src/api/announcement/types.ts @@ -6,7 +6,7 @@ type AnnouncementResponse = { user_id: number, name: string, category: Category, - best_by: number, + best_by: string, address: string, longtitude: number, latitude: number, @@ -23,7 +23,7 @@ const isAnnouncementResponse = (obj: unknown): obj is AnnouncementResponse => ( 'user_id': 'number', 'name': 'string', 'category': isCategory, - 'best_by': 'number', + 'best_by': 'string', 'address': 'string', 'longtitude': 'number', 'latitude': 'number', diff --git a/front/src/api/announcements/index.ts b/front/src/api/announcements/index.ts index 1946d5c..22889e7 100644 --- a/front/src/api/announcements/index.ts +++ b/front/src/api/announcements/index.ts @@ -11,7 +11,7 @@ const composeAnnouncementsURL = (filters: FiltersType) => ( ) const processAnnouncements = (data: AnnouncementsResponse): Announcement[] => ( - data.list_of_announcements.map(processAnnouncement) + data.map(processAnnouncement) ) export { initialAnnouncements, composeAnnouncementsURL, processAnnouncements } diff --git a/front/src/api/announcements/types.ts b/front/src/api/announcements/types.ts index 6c3b89e..37e86cc 100644 --- a/front/src/api/announcements/types.ts +++ b/front/src/api/announcements/types.ts @@ -1,16 +1,10 @@ -import { isArrayOf, isObject } from '../../utils/types' +import { isArrayOf } from '../../utils/types' import { AnnouncementResponse, isAnnouncementResponse } from '../announcement/types' -type AnnouncementsResponse = { - list_of_announcements: AnnouncementResponse[], - Success: boolean, -} +type AnnouncementsResponse = AnnouncementResponse[] const isAnnouncementsResponse = (obj: unknown): obj is AnnouncementsResponse => ( - isObject(obj, { - 'list_of_announcements': obj => isArrayOf(obj, isAnnouncementResponse), - 'Success': 'boolean', - }) + isArrayOf(obj, isAnnouncementResponse) ) export type {