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:
27
server/api/devtool/content/code/prettier-format.js
Normal file
27
server/api/devtool/content/code/prettier-format.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import prettier from "prettier";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const body = await readBody(event);
|
||||
|
||||
try {
|
||||
if (body.code === undefined) {
|
||||
return {
|
||||
statusCode: 400,
|
||||
message: "Bad Request",
|
||||
};
|
||||
}
|
||||
|
||||
const code = prettier.format(body.code, { semi: false, parser: "vue" });
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
message: "Code successfully formatted",
|
||||
data: code,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
statusCode: 500,
|
||||
message: "Internal Server Error",
|
||||
};
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user