fix
Deploy banu-front / deploy (push) Successful in 1m27s

This commit is contained in:
sajjadtalkhabi
2026-07-07 17:36:43 +03:30
parent b9ef684b51
commit 38a396ba21
89 changed files with 1815 additions and 478 deletions
+15 -6
View File
@@ -70,16 +70,25 @@ export const useGetRegistrationVideoQuery = (options = {}) =>
export const useUploadMediaMutation = () => useMutation({ mutationFn: apiUploadMedia })
// Register-data is a flat `{ field: value }` object; legacy responses were a
// `[{ key, value }]` list. Normalize both into the object shape.
const toRegisterDataObject = (response) => {
const body = response?.data ?? response
const raw = Array.isArray(body) ? body : body?.data ?? body
if (Array.isArray(raw)) {
return raw.reduce((acc, item) => {
if (item && typeof item === 'object' && 'key' in item) acc[item.key] = item.value
return acc
}, {})
}
return raw && typeof raw === 'object' ? raw : {}
}
export const useGetRegisterDataQuery = (options = {}) =>
useQuery({
queryKey: authKeys.registerData(),
queryFn: () => apiGetRegisterData(),
select: (response) => {
const data = response?.data ?? response
if (Array.isArray(data)) return data
if (Array.isArray(data?.data)) return data.data
return []
},
select: toRegisterDataObject,
...options,
})