Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d0afdd
commit 1b8044c
Showing
3 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useLazyAxios } from 'use-axios-client'; | ||
import { MethodMetadata } from '..'; | ||
import { URL } from '../../helpers/axios'; | ||
|
||
const path = 'countries'; | ||
|
||
export function useMethod() { | ||
const [getData, { data, error, loading }] = useLazyAxios({ | ||
url: `${URL}${path}`, | ||
}); | ||
return { data, error, loading, getData }; | ||
} | ||
|
||
export const metadata: MethodMetadata = { | ||
author: 'Gabriela Golmar', | ||
authorPicture: '', | ||
description: 'pulls the full list of countries', | ||
name: path, | ||
method: 'GET', | ||
parameters: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { MethodMetadata, Parameter } from '..'; | ||
import { Headers } from '../../helpers/axios'; | ||
import { useRestCall } from '../../helpers/rest-calls'; | ||
|
||
const path = 'country'; | ||
|
||
export function useMethod({ pathParameters, body }: any) { | ||
const { data, error, loading, getData } = useRestCall({ | ||
pathParameters, | ||
headers: Headers, | ||
body, | ||
metadata, | ||
}); | ||
return { data, error, loading, getData }; | ||
} | ||
|
||
const parameters: Parameter[] = [ | ||
{ | ||
key: 1, | ||
name: 'bankApproved', | ||
description: '', | ||
required: 'yes', | ||
default: '', | ||
}, | ||
{ | ||
key: 2, | ||
name: 'phoneCode', | ||
description: '', | ||
required: 'yes', | ||
default: '', | ||
}, | ||
{ | ||
key: 3, | ||
name: 'iso2', | ||
description: '', | ||
required: 'yes', | ||
default: '', | ||
}, | ||
{ | ||
key: 4, | ||
name: 'iso3', | ||
description: '', | ||
required: 'yes', | ||
default: '', | ||
}, | ||
{ | ||
key: 5, | ||
name: 'abbreviation', | ||
description: '', | ||
required: 'yes', | ||
default: '', | ||
}, | ||
{ | ||
key: 6, | ||
name: 'name', | ||
description: '', | ||
required: 'yes', | ||
default: '', | ||
}, | ||
{ | ||
key: 7, | ||
name: 'version', | ||
description: '', | ||
required: 'yes', | ||
default: '', | ||
}, | ||
]; | ||
|
||
export const metadata: MethodMetadata = { | ||
author: 'Gabriela Golmar', | ||
authorPicture: '', | ||
description: 'upserts a single country record', | ||
name: path, | ||
method: 'POST', | ||
parameters, | ||
}; |