aboutsummaryrefslogblamecommitdiffhomepage
path: root/shared/utils/requests/check-api-params.ts
blob: a2a549682aac9bd5f1646f8a69cfa85fc3475269 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                           
                                                
 
                                                                                          


                         
          
                                                      



                           
                                                                                          


                         
          
                                                      



                           
                                                                                         


                         
          
                                                     










                                                                              
import { makeGetRequest } from './requests'
import { immutableAssign } from '../miscs/miscs'

function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
  return makeGetRequest({
    url,
    path,
    token,
    query: immutableAssign(query, { start: 'hello' }),
    statusCodeExpected: 400
  })
}

function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
  return makeGetRequest({
    url,
    path,
    token,
    query: immutableAssign(query, { count: 'hello' }),
    statusCodeExpected: 400
  })
}

function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
  return makeGetRequest({
    url,
    path,
    token,
    query: immutableAssign(query, { sort: 'hello' }),
    statusCodeExpected: 400
  })
}

// ---------------------------------------------------------------------------

export {
  checkBadStartPagination,
  checkBadCountPagination,
  checkBadSortPagination
}