fix: complete registration frontend flow
Deploy banu-front / deploy (push) Successful in 1m40s

This commit is contained in:
Server Migration
2026-08-15 17:28:40 +03:30
parent d94a96b25e
commit b64f528c0d
20 changed files with 431 additions and 158 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ export const currentMe = {
lastName: 'محمدی',
fullName: 'سجاد محمدی',
phoneNumber: '09123456789',
nationalCode: '0079827498',
nationalCode: '0079827497',
status: 'approved',
address: {
address: 'خیابان آزادی، پلاک ۱۲',
+8
View File
@@ -4,6 +4,7 @@ import { endpoints } from '@/services/api/endpoints'
import { currentMe } from '@/services/mock/fixtures/me'
const fakeToken = 'mock-token-1234567890'
let registerData = {}
register('POST', endpoints.login, () => ({
data: { user: currentMe, token: fakeToken },
@@ -86,6 +87,13 @@ register('POST', endpoints.completeProfile, ({ data }) => ({
data: { user: { ...currentMe, ...data } },
}))
register('GET', endpoints.registerData, () => ({ data: registerData }))
register('POST', endpoints.registerData, ({ data }) => {
registerData = { ...registerData, ...data?.data }
return { data: registerData }
})
register('GET', endpoints.getRegistrationQuestionVideo, () => ({
data: { url: '', id: 0 },
}))
+12 -1
View File
@@ -60,10 +60,21 @@ export const useCompleteProfileMutation = () => useMutation({ mutationFn: apiCom
export const useUpdateProfileMutation = () => useMutation({ mutationFn: apiUpdateProfile })
const getRegistrationVideoIfAvailable = async () => {
try {
return await apiGetRegistrationQuestionVideo()
} catch (error) {
// The migrated backend does not expose this optional content endpoint yet.
// Treat a missing route as "no tutorial uploaded" so registration remains usable.
if (error?.response?.status === 404) return {}
throw error
}
}
export const useGetRegistrationVideoQuery = (options = {}) =>
useQuery({
queryKey: authKeys.registrationVideo(),
queryFn: () => apiGetRegistrationQuestionVideo(),
queryFn: getRegistrationVideoIfAvailable,
select: (response) => response?.data ?? response,
...options,
})