2024-02-15 02:16:38 -05:00
|
|
|
import { getAccessToken, withApiAuthRequired } from '@auth0/nextjs-auth0';
|
|
|
|
import { IncomingForm } from 'formidable'
|
|
|
|
import fs from 'fs/promises';
|
|
|
|
|
|
|
|
export const config = {
|
|
|
|
api: {
|
|
|
|
bodyParser: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
async function createBlobFromFile(path: string): Promise<Blob> {
|
|
|
|
const file = await fs.readFile(path);
|
|
|
|
return new Blob([file]);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withApiAuthRequired(async function handler(req, res) {
|
|
|
|
const { accessToken } = await getAccessToken(req, res);
|
|
|
|
const { id } = req.query;
|
|
|
|
|
2024-02-25 18:34:51 -05:00
|
|
|
const response = await fetch(process.env.NEXT_PUBLIC_API_URL + '/api/Artist/Portfolio/'+id, {
|
2024-02-15 02:16:38 -05:00
|
|
|
method: 'DELETE',
|
|
|
|
headers: {
|
|
|
|
"Authorization": `Bearer ${accessToken}`
|
|
|
|
},
|
|
|
|
});
|
|
|
|
res.status(200).json({status: await response.json()});
|
|
|
|
});
|