fix: use mutation variables in onSuccess, fix null displayName handling

This commit is contained in:
Kirill
2026-05-21 20:42:59 +05:00
parent 0dfa428931
commit 52290e162e
3 changed files with 8 additions and 8 deletions
Binary file not shown.
+2 -1
View File
@@ -18,7 +18,8 @@ export async function registerAdminProfileRoutes(fastify) {
fastify.patch('/api/admin/profile', { preHandler: [fastify.verifyAdmin] }, async (request, reply) => {
const userId = request.user.sub
const nameRaw = request.body?.displayName
const displayName = nameRaw === null || nameRaw === undefined ? undefined : String(nameRaw).trim()
const displayName =
nameRaw === undefined ? undefined : nameRaw === null ? null : nameRaw === '' ? null : String(nameRaw).trim()
const avatarRaw = request.body?.avatar
const avatar = avatarRaw === null || avatarRaw === undefined ? undefined : String(avatarRaw).trim()
const avatarTypeRaw = request.body?.avatarType