Update various configuration files, components, and assets; enhance notification system and API endpoints; improve documentation and styles across the application.
This commit is contained in:
22
server/api/devtool/content/code/save.js
Normal file
22
server/api/devtool/content/code/save.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const body = await readBody(event);
|
||||
|
||||
try {
|
||||
// Overwrite vue code from path in body with new code
|
||||
const filePath = path.join(process.cwd() + "/pages/", body.path + ".vue");
|
||||
fs.writeFileSync(filePath, body.code, "utf8");
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
message: "Code successfully saved",
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
statusCode: 500,
|
||||
message: "Internal Server Error",
|
||||
};
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user