first commit
This commit is contained in:
19
server/api/address/postal.get.ts
Normal file
19
server/api/address/postal.get.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const query = getQuery(event)
|
||||
const parent = JSON.parse(query.parent)
|
||||
|
||||
try {
|
||||
const results = await prisma.postal.findFirst({
|
||||
where: {
|
||||
id: parseInt(parent._id),
|
||||
},
|
||||
})
|
||||
return results.postal
|
||||
} catch (error) {
|
||||
// Return error if fetching users fails
|
||||
return {
|
||||
status: 500,
|
||||
body: { message: 'Failed to fetch postal' },
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user