mirror of
https://github.com/D4M13N-D3V/comissions-app-ui.git
synced 2025-03-14 00:05:07 +00:00
23 lines
814 B
TypeScript
23 lines
814 B
TypeScript
import { getAccessToken, withApiAuthRequired, getSession } from '@auth0/nextjs-auth0';
|
|
import { IncomingForm } from 'formidable';
|
|
import fs from 'fs/promises';
|
|
|
|
async function createBlobFromFile(path: string): Promise<Blob> {
|
|
const file = await fs.readFile(path);
|
|
return new Blob([file]);
|
|
}
|
|
export default withApiAuthRequired(async function products(req, res) {
|
|
const { accessToken } = await getAccessToken(req, res);
|
|
const requestId = req.query.requestId;
|
|
const response = await fetch(process.env.NEXT_PUBLIC_API_URL+'/api/Requests/Customer/'+requestId+'/References', {
|
|
headers: {
|
|
"Authorization": `Bearer ${accessToken}`,
|
|
'Content-Type': 'application/json'
|
|
},
|
|
method: req.method
|
|
});
|
|
let result = await response.json();
|
|
res.status(200).json(result);
|
|
});
|
|
|