import { API_URL } from '../../config'
import { RemoveAnnouncement, RemoveAnnouncementResponse } from './types'

const composeRemoveAnnouncementURL = () => (
    API_URL + '/announcement?'
)

function processRemoveAnnouncement(data: RemoveAnnouncementResponse): RemoveAnnouncement {
    if (!data.Success) {
        throw new Error('Не удалось закрыть объявление')
    }

    return data.Success
}

export { composeRemoveAnnouncementURL, processRemoveAnnouncement }
