Skip to content

Commit

Permalink
import headers
Browse files Browse the repository at this point in the history
  • Loading branch information
gabitanalla committed Apr 12, 2022
1 parent ce12cf4 commit aadc9fe
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/common/components/rest-method/rest-method.tsx
Expand Up @@ -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);
};

Expand Down
1 change: 1 addition & 0 deletions src/common/helpers/rest-calls/index.ts
Expand Up @@ -24,6 +24,7 @@ export const useRestCall = ({
}
return newPath;
}, [pathParameters]);
console.log(fullPath)
const [getData, { data, error, loading }] = useLazyAxios({
url: `${URL}${fullPath}`,
headers,
Expand Down
19 changes: 10 additions & 9 deletions 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: [],
Expand Down
1 change: 1 addition & 0 deletions 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';
Expand Down
29 changes: 15 additions & 14 deletions 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: [],
};
3 changes: 2 additions & 1 deletion 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({
Expand Down
3 changes: 2 additions & 1 deletion 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({
Expand Down
1 change: 1 addition & 0 deletions 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';
Expand Down
11 changes: 6 additions & 5 deletions 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',
Expand Down
3 changes: 2 additions & 1 deletion 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({
Expand Down

0 comments on commit aadc9fe

Please sign in to comment.