import { AUTH_SERVICE } from 'config'
import { callApi, readToken } from 'helpers'

export type CountryCodeType = {
  country_code?: string,
  error?: string,
  ok: boolean,
}

export const getCountryCode = async (): Promise<CountryCodeType> => {
  const config = {
    method: 'GET',
  }

  return callApi({
    config,
    url: `${AUTH_SERVICE}/country?refresh_token=${readToken()}`,
  })
}
