alsaze 4c13799f44
All checks were successful
Deploy / build (push) Successful in 43s
init
2025-11-19 20:37:10 +03:00

21 lines
549 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { createError, defineEventHandler, sendError } from 'h3'
export default defineEventHandler(async (event) => {
try {
const apiUrl = import.meta.env.VITE_MY_API_BASE_URL!
return await $fetch<Users>(`${apiUrl}/users`, {
headers: {
'Content-Type': 'application/json',
'Accept-Language': 'ru-RU',
},
})
}
catch (error) {
return sendError(event, createError({
statusCode: 500,
statusMessage: `Не удалось получить пользователей: ${error}`,
}))
}
})