add interactions to comments
This commit is contained in:
26
server/api/charte/index.get.ts
Normal file
26
server/api/charte/index.get.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import prisma from '~/lib/prisma';
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
try {
|
||||
const chartes = await prisma.charte.findMany();
|
||||
|
||||
if (!chartes || chartes.length === 0) {
|
||||
return {
|
||||
success: false,
|
||||
data: null,
|
||||
message: 'No chartes found.',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: chartes,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error fetching chartes:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error.message,
|
||||
};
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user