At the moment, API ni run kat my local development (http://gateway.jourdein.com
)
Sample response bila call API /api/v1/drivers/account-verification/phone
{
"registration": {
"step": "2",
"count": "4",
"name": "email_verification",
"path": "/api/v1/drivers/account-verification/email"
}
}
Ni menunjukkan registration is incomplete at step 2. Total registration step adalah 4.
Jadi bila call API /api/v1/drivers/account-verification/email
dengan params correct code akan return
{
"message": "Email verified successfully"
}
Later, bila cuba nak call sekali lagi API /api/v1/drivers/account-verification/email
BE akan return
{
"registration": {
"step": "3",
"count": "4",
"name": "add_phone_number",
"path": "/api/v1/drivers/account-verification/phone"
}
}
This response indicates that registration sekarang incomplete kat step no 3
cuma pelik sikit sbb user kena try register baru dpt tau progress kalau blh buat endpoint yg terus response mana blm complete ikut token ok jgk
- logically bila user dah ada akaun, baru boleh track progress.
- maknanya: registered, logged in → (kita memang track user by their valid jwt-token)
- bukan kat register sahaja boleh dapat progress.
- other API pun akan return progress kalau user masih tak complete the registration process
- aku tambah API untuk ko dapat response registration progress
- at the moment response API tu sama je dengan response API yang lain. takde bezanya
Penerangan tentang Application Progress Response
- Progress response ni dah belong in simple Authorization
- Implemented after/together dengan Authentication
- Incomplete registration ni kira un-Authorized user. BE also return
401 Unauthorized
header on any API. - Tapi without piggy 401 response, nanti app kena call API
application-progress
untuk check kat mana application progress stop.
And also, aku rasa the registration progress ni total hanya 4 sahaja sebab view untuk Successfully verify email tu macam hanya notification/info screen sahaja.
Dan button "Send verification code" tu sepatutnya kat next screen (screen Add phone number)