mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-08-30 12:35:00 -05:00
20 lines
547 B
TypeScript
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'
|
|
}
|
|
});
|
|
});
|