mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-09-13 11:27:28 -05:00
feat: fix account server api calls
This commit is contained in:
@@ -2,17 +2,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);
|
||||
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', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${auth.token}`
|
||||
},
|
||||
body: {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
mii: body.mii,
|
||||
environment: body.environment
|
||||
}),
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,6 +8,8 @@ export default defineEventHandler(async (event): Promise<GetApiAuthMe> => {
|
||||
return {
|
||||
pid: data.pid,
|
||||
username: data.username,
|
||||
accessLevel: data.accessLevel,
|
||||
serverAccessLevel: data.serverAccessLevel as any,
|
||||
mii: data.mii
|
||||
? {
|
||||
imageUrl: `https://r2-cdn.pretendo.cc/mii/${data.pid}/normal_face.png`,
|
||||
|
||||
Reference in New Issue
Block a user