Commit 8d1b061b authored by tom's avatar tom

move api helpers outside of page folder

parent ec28e167
import type { NextApiRequest, NextApiResponse } from 'next';
import fetch from './fetch';
import fetch from 'lib/api/fetch';
type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE';
......
import type { NextApiRequest } from 'next';
import handler from 'pages/api/utils/handler';
import handler from 'lib/api/handler';
const getUrl = (req: NextApiRequest) => {
return `/account/v1/user/api_keys/${ req.query.id }`;
......
import type { ApiKeys } from 'types/api/account';
import handler from 'pages/api/utils/handler';
import handler from 'lib/api/handler';
const apiKeysHandler = handler<ApiKeys>(() => '/account/v1/user/api_keys', [ 'GET', 'POST' ]);
......
import type { NextApiRequest } from 'next';
import handler from 'pages/api/utils/handler';
import handler from 'lib/api/handler';
const getUrl = (req: NextApiRequest) => {
return `/account/v1/user/tags/address/${ req.query.id }`;
......
import type { AddressTags } from 'types/api/account';
import handler from 'pages/api/utils/handler';
import handler from 'lib/api/handler';
const addressHandler = handler<AddressTags>(() => '/account/v1/user/tags/address', [ 'GET', 'POST' ]);
......
import type { NextApiRequest } from 'next';
import handler from 'pages/api/utils/handler';
import handler from 'lib/api/handler';
const getUrl = (req: NextApiRequest) => {
return `/account/v1/user/tags/transaction/${ req.query.id }`;
......
import type { TransactionTags } from 'types/api/account';
import handler from 'pages/api/utils/handler';
import handler from 'lib/api/handler';
const transactionHandler = handler<TransactionTags>(() => '/account/v1/user/tags/transaction', [ 'GET', 'POST' ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment