Files
website/server/api/account/update.patch.ts
mrjvs b342a595ba
Some checks failed
Build and Publish Docker Image / Build and Publish (amd64) (push) Has been cancelled
Build and Publish Docker Image / Build and Publish (arm64) (push) Has been cancelled
feat: fix account server api calls
2026-08-11 22:14:40 +02:00

20 lines
547 B
TypeScript

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