From aadc9fe9f8c90372dd6740caf85b7fd79210a780 Mon Sep 17 00:00:00 2001 From: gabitanalla Date: Tue, 12 Apr 2022 11:49:31 -0300 Subject: [PATCH] import headers --- .../components/rest-method/rest-method.tsx | 2 +- src/common/helpers/rest-calls/index.ts | 1 + src/common/rest/get-vezgo-account/index.ts | 19 ++++++------ src/common/rest/get-vezgo-insight/index.ts | 1 + .../rest/get-vezgo-transaction/index.ts | 29 ++++++++++--------- .../rest/get-vezgo-user-accounts/index.ts | 3 +- .../rest/get-vezgo-user-transactions/index.ts | 3 +- src/common/rest/post-vezgo-accounts/index.ts | 1 + src/common/rest/post-vezgo-insight/index.ts | 11 +++---- .../rest/post-vezgo-transactions/index.ts | 3 +- 10 files changed, 41 insertions(+), 32 deletions(-) diff --git a/src/common/components/rest-method/rest-method.tsx b/src/common/components/rest-method/rest-method.tsx index 25d64af6..486ced23 100644 --- a/src/common/components/rest-method/rest-method.tsx +++ b/src/common/components/rest-method/rest-method.tsx @@ -43,7 +43,7 @@ export const RestMethod = ({ const { getData, data } = useMethod({ pathParameters, body: customParameters }); const handleCall = async () => { - const dt = await getData(customParameters); + const dt = await getData(); console.log(dt); }; diff --git a/src/common/helpers/rest-calls/index.ts b/src/common/helpers/rest-calls/index.ts index 79083f88..61bc9658 100644 --- a/src/common/helpers/rest-calls/index.ts +++ b/src/common/helpers/rest-calls/index.ts @@ -24,6 +24,7 @@ export const useRestCall = ({ } return newPath; }, [pathParameters]); + console.log(fullPath) const [getData, { data, error, loading }] = useLazyAxios({ url: `${URL}${fullPath}`, headers, diff --git a/src/common/rest/get-vezgo-account/index.ts b/src/common/rest/get-vezgo-account/index.ts index e318807b..4fe36f00 100644 --- a/src/common/rest/get-vezgo-account/index.ts +++ b/src/common/rest/get-vezgo-account/index.ts @@ -1,22 +1,23 @@ import { MethodMetadata } from '..'; +import { Headers } from '../../helpers/axios'; import { useRestCall } from '../../helpers/rest-calls'; -const path = 'vezgo-account/:accountId'; +const path = 'vesgo-account/:accountId'; export function useMethod({ pathParameters, body }: any) { - const { data, error, loading, getData } = useRestCall({ - pathParameters, - headers: Headers, - body, - metadata, - }); - return { data, error, loading, getData }; + const { data, error, loading, getData } = useRestCall({ + pathParameters, + headers: Headers, + body, + metadata, + }); + return { data, error, loading, getData }; } export const metadata: MethodMetadata = { author: 'Gabriela Golmar', authorPicture: '', - description: 'This is our get account', + description: 'This is our get vezgo account', name: path, method: 'GET', parameters: [], diff --git a/src/common/rest/get-vezgo-insight/index.ts b/src/common/rest/get-vezgo-insight/index.ts index 9e957b73..b8756ebb 100644 --- a/src/common/rest/get-vezgo-insight/index.ts +++ b/src/common/rest/get-vezgo-insight/index.ts @@ -1,4 +1,5 @@ import { MethodMetadata } from '..'; +import { Headers } from '../../helpers/axios'; import { useRestCall } from '../../helpers/rest-calls'; const path = 'insight/:id'; diff --git a/src/common/rest/get-vezgo-transaction/index.ts b/src/common/rest/get-vezgo-transaction/index.ts index 8f0e6b80..cbcb7d4f 100644 --- a/src/common/rest/get-vezgo-transaction/index.ts +++ b/src/common/rest/get-vezgo-transaction/index.ts @@ -1,23 +1,24 @@ import { MethodMetadata } from '..'; +import { Headers } from '../../helpers/axios'; import { useRestCall } from '../../helpers/rest-calls'; -const path = 'vezgo-transaction/:transactionId'; +const path = 'vesgo-transactions/:userProfileId'; export function useMethod({ pathParameters, body }: any) { - const { data, error, loading, getData } = useRestCall({ - pathParameters, - headers: Headers, - body, - metadata, - }); - return { data, error, loading, getData }; + const { data, error, loading, getData } = useRestCall({ + pathParameters, + headers: Headers, + body, + metadata, + }); + return { data, error, loading, getData }; } export const metadata: MethodMetadata = { - author: 'Gabriela Golmar', - authorPicture: '', - description: 'This is our get vezgo transaction', - name: path, - method: 'GET', - parameters: [], + author: 'Gabriela Golmar', + authorPicture: '', + description: 'This is our get vezgo transaction', + name: path, + method: 'GET', + parameters: [], }; diff --git a/src/common/rest/get-vezgo-user-accounts/index.ts b/src/common/rest/get-vezgo-user-accounts/index.ts index 8b50f6f9..22ebfa76 100644 --- a/src/common/rest/get-vezgo-user-accounts/index.ts +++ b/src/common/rest/get-vezgo-user-accounts/index.ts @@ -1,7 +1,8 @@ import { MethodMetadata } from '..'; +import { Headers } from '../../helpers/axios'; import { useRestCall } from '../../helpers/rest-calls'; -const path = 'vezgo-accounts/:userProfileId'; +const path = 'vesgo-accounts/:userProfileId'; export function useMethod({ pathParameters, body }: any) { const { data, error, loading, getData } = useRestCall({ diff --git a/src/common/rest/get-vezgo-user-transactions/index.ts b/src/common/rest/get-vezgo-user-transactions/index.ts index 6e578d23..235226f1 100644 --- a/src/common/rest/get-vezgo-user-transactions/index.ts +++ b/src/common/rest/get-vezgo-user-transactions/index.ts @@ -1,7 +1,8 @@ import { MethodMetadata } from '..'; +import { Headers } from '../../helpers/axios'; import { useRestCall } from '../../helpers/rest-calls'; -const path = 'vezgo-transactions/:userProfileId'; +const path = 'vesgo-transactions/:userProfileId'; export function useMethod({ pathParameters, body }: any) { const { data, error, loading, getData } = useRestCall({ diff --git a/src/common/rest/post-vezgo-accounts/index.ts b/src/common/rest/post-vezgo-accounts/index.ts index b605cf87..75b956ab 100644 --- a/src/common/rest/post-vezgo-accounts/index.ts +++ b/src/common/rest/post-vezgo-accounts/index.ts @@ -1,4 +1,5 @@ import { MethodMetadata, Parameter } from '..'; +import { Headers } from '../../helpers/axios'; import { useRestCall } from '../../helpers/rest-calls'; const path = 'vesgo-accounts/:userProfileId'; diff --git a/src/common/rest/post-vezgo-insight/index.ts b/src/common/rest/post-vezgo-insight/index.ts index bebb3e0c..13e2326d 100644 --- a/src/common/rest/post-vezgo-insight/index.ts +++ b/src/common/rest/post-vezgo-insight/index.ts @@ -1,17 +1,18 @@ import { MethodMetadata } from '..'; +import { Headers } from '../../helpers/axios'; import { useRestCall } from '../../helpers/rest-calls'; const path = 'insight'; export function useMethod({ pathParameters, body }: any) { const { data, error, loading, getData } = useRestCall({ - pathParameters, - headers: Headers, - body, - metadata, + pathParameters, + headers: Headers, + body, + metadata, }); return { data, error, loading, getData }; -} + } export const metadata: MethodMetadata = { author: 'Gabriela Golmar', diff --git a/src/common/rest/post-vezgo-transactions/index.ts b/src/common/rest/post-vezgo-transactions/index.ts index 84d70650..1708bc1b 100644 --- a/src/common/rest/post-vezgo-transactions/index.ts +++ b/src/common/rest/post-vezgo-transactions/index.ts @@ -1,7 +1,8 @@ import { MethodMetadata, Parameter } from '..'; +import { Headers } from '../../helpers/axios'; import { useRestCall } from '../../helpers/rest-calls'; -const path = 'vezgo-transactions/:userProfileId'; +const path = 'vesgo-transactions/:userProfileId'; export function useMethod({ pathParameters, body }: any) { const { data, error, loading, getData } = useRestCall({