Renamed Answer to Success return fields on front

This commit is contained in:
Dmitriy Shishkov 2023-09-13 22:41:53 +03:00
parent 2b001579c5
commit 18a7a0cbb9
Signed by: dm1sh
GPG Key ID: 027994B0AA357688
4 changed files with 7 additions and 7 deletions

View File

@ -6,7 +6,7 @@ const composePutAnnouncementURL = () => (
) )
const processPutAnnouncement = (data: PutAnnouncementResponse): PutAnnouncement => { const processPutAnnouncement = (data: PutAnnouncementResponse): PutAnnouncement => {
return data.Answer return data.Success
} }
export { composePutAnnouncementURL, processPutAnnouncement } export { composePutAnnouncementURL, processPutAnnouncement }

View File

@ -1,12 +1,12 @@
import { isObject } from '../../utils/types' import { isObject } from '../../utils/types'
type PutAnnouncementResponse = { type PutAnnouncementResponse = {
Answer: boolean, Success: boolean,
} }
const isPutAnnouncementResponse = (obj: unknown): obj is PutAnnouncementResponse => ( const isPutAnnouncementResponse = (obj: unknown): obj is PutAnnouncementResponse => (
isObject(obj, { isObject(obj, {
'Answer': 'boolean', 'Success': 'boolean',
}) })
) )

View File

@ -6,11 +6,11 @@ const composeRemoveAnnouncementURL = () => (
) )
function processRemoveAnnouncement(data: RemoveAnnouncementResponse): RemoveAnnouncement { function processRemoveAnnouncement(data: RemoveAnnouncementResponse): RemoveAnnouncement {
if (!data.Answer) { if (!data.Success) {
throw new Error('Не удалось закрыть объявление') throw new Error('Не удалось закрыть объявление')
} }
return data.Answer return data.Success
} }
export { composeRemoveAnnouncementURL, processRemoveAnnouncement } export { composeRemoveAnnouncementURL, processRemoveAnnouncement }

View File

@ -1,12 +1,12 @@
import { isObject } from '../../utils/types' import { isObject } from '../../utils/types'
type RemoveAnnouncementResponse = { type RemoveAnnouncementResponse = {
Answer: boolean, Success: boolean,
} }
const isRemoveAnnouncementResponse = (obj: unknown): obj is RemoveAnnouncementResponse => ( const isRemoveAnnouncementResponse = (obj: unknown): obj is RemoveAnnouncementResponse => (
isObject(obj, { isObject(obj, {
'Answer': 'boolean', 'Success': 'boolean',
}) })
) )