From 64237b36554a472d208e7b4b17e7bc5ba2541d45 Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Fri, 12 Aug 2022 14:22:59 +0400 Subject: [PATCH] fix(#2652): add method for get country code from auth --- src/requests/getCountryCode.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/requests/getCountryCode.tsx diff --git a/src/requests/getCountryCode.tsx b/src/requests/getCountryCode.tsx new file mode 100644 index 00000000..99e67e84 --- /dev/null +++ b/src/requests/getCountryCode.tsx @@ -0,0 +1,19 @@ +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 => { + const config = { + method: 'GET', + } + + return callApi({ + config, + url: `${AUTH_SERVICE}/country?refresh_token=${readToken()}`, + }) +}