parent
5a89830556
commit
f18b452fc1
@ -1,3 +1,4 @@ |
||||
export * from './routes' |
||||
export * from './pages' |
||||
export * from './authKeys' |
||||
export * from './procedures' |
||||
|
||||
@ -0,0 +1,3 @@ |
||||
export const PROCEDURES = { |
||||
lst_c_country: 'lst_c_country', |
||||
} |
||||
@ -1,2 +1,2 @@ |
||||
export const API_ROOT = '' |
||||
export const API_ROOT = 'http://85.10.224.24:8080' |
||||
export const DATA_URL = `${API_ROOT}/data` |
||||
|
||||
@ -1,3 +1,3 @@ |
||||
export const getResponseData = (proc: string) => (response: any) => ( |
||||
response?.data?.[0]?.[proc] |
||||
response?.[proc] |
||||
) |
||||
|
||||
@ -1 +1,2 @@ |
||||
export * from './callApi' |
||||
export * from './callApi/getResponseData' |
||||
|
||||
@ -0,0 +1,28 @@ |
||||
import { DATA_URL, PROCEDURES } from 'config' |
||||
import { callApi, getResponseData } from 'helpers' |
||||
|
||||
const proc = PROCEDURES.lst_c_country |
||||
|
||||
export type Country = { |
||||
id: number, |
||||
iso_3166_1_alpha_2: string, |
||||
iso_3166_1_alpha_3: string, |
||||
name_eng: string, |
||||
name_rus: string, |
||||
} |
||||
|
||||
export type Countries = Array<Country> |
||||
|
||||
export const getCountries = (): Promise<Countries> => { |
||||
const config = { |
||||
body: { |
||||
params: null, |
||||
proc, |
||||
}, |
||||
} |
||||
|
||||
return callApi({ |
||||
config, |
||||
url: DATA_URL, |
||||
}).then(getResponseData(proc)) |
||||
} |
||||
@ -1 +1,2 @@ |
||||
export * from './login' |
||||
export * from './getCountries' |
||||
|
||||
Loading…
Reference in new issue