Files
website/server/api/account/update.patch.ts
2026-08-09 21:28:45 +02:00

19 lines
504 B
TypeScript

import { AccountUpdateSchema } from '~~/shared/api-types';
export default defineEventHandler(async (event): Promise<void> => {
const body = await readZodBody(event, AccountUpdateSchema);
const apiFetch = useHttpApi(event);
const auth = enforceLoggedIn(event);
// There's no equivalent GRPC endpoint to use, so we're using the HTTP api
await apiFetch('/v1/user', {
headers: {
Authorization: `Bearer ${auth.token}`
},
body: {
mii: body.mii,
environment: body.environment
}
});
});