upload fies to storage account for appeal
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import {
|
||||
createContainer,
|
||||
getContainers,
|
||||
getBlobs,
|
||||
createBlob,
|
||||
uploadFile,
|
||||
} from "../../../actions/azurestorage";
|
||||
|
||||
import middleware from "../middleware/middleware";
|
||||
import nextConnect from "next-connect";
|
||||
|
||||
const ApiProxy = nextConnect();
|
||||
ApiProxy.use(middleware);
|
||||
|
||||
ApiProxy.post(async (req, res) => {
|
||||
console.log(JSON.parse(req.body.appealData));
|
||||
console.log(req.files);
|
||||
|
||||
const appealData = JSON.parse(req.body.appealData);
|
||||
|
||||
createContainer(appealData.pinswg_name.trim()).then((containerName) => {
|
||||
createBlob(appealData, containerName).then((data) => {
|
||||
uploadFile(req.files, containerName, data);
|
||||
});
|
||||
});
|
||||
|
||||
return res.status(200).json({ data: "success" });
|
||||
});
|
||||
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: false,
|
||||
},
|
||||
};
|
||||
|
||||
export default ApiProxy;
|
||||
Reference in New Issue
Block a user