You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
590 B
28 lines
590 B
import { NextApiRequest, NextApiResponse } from 'next'; |
|
|
|
import getOneAnvil from './getOneAnvil'; |
|
|
|
async function handleAPIGetOneAnvil( |
|
request: NextApiRequest, |
|
response: NextApiResponse, |
|
): Promise<void> { |
|
const { |
|
query: { uuid }, |
|
}: NextApiRequest = request; |
|
|
|
const anvilUUID: string = uuid instanceof Array ? uuid[0] : uuid; |
|
|
|
const { anvilStatus, error }: GetOneAnvilResponse = await getOneAnvil( |
|
anvilUUID, |
|
); |
|
|
|
if (error) { |
|
response.status(503); |
|
} else { |
|
response.status(200); |
|
} |
|
|
|
response.send(anvilStatus); |
|
} |
|
|
|
export default handleAPIGetOneAnvil;
|
|
|