mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-09-07 08:26:37 -05:00
feat: implement account updates on backend
This commit is contained in:
18
server/api/account/update.patch.ts
Normal file
18
server/api/account/update.patch.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user