import { API_URL } from '../../config'
import { Book, BookResponse } from './types'

const composeBookURL = () => (
    API_URL + '/book?'
)

const processBook = (data: BookResponse): Book => {
    if (!data.Success) {
        throw new Error('Не удалось забронировать объявление')
    }

    return data.Success
}

export { composeBookURL, processBook }
