feat: fix account server api calls
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

This commit is contained in:
mrjvs
2026-08-11 22:14:40 +02:00
parent 5655ad22ec
commit b342a595ba
7 changed files with 51 additions and 12 deletions

View File

@@ -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'
}
});
});

View File

@@ -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`,