Skip to content

Instantly share code, notes, and snippets.

@jourdein
Last active January 27, 2023 02:43
Show Gist options
  • Save jourdein/8650910e13ade0d696ba578bc856feb3 to your computer and use it in GitHub Desktop.
Save jourdein/8650910e13ade0d696ba578bc856feb3 to your computer and use it in GitHub Desktop.
Registration progress response

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

UPDATE

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

progress

  • logically bila user dah ada akaun, baru boleh track progress.
  • maknanya: registered, logged in → (kita memang track user by their valid jwt-token)

try register

  • bukan kat register sahaja boleh dapat progress.
  • other API pun akan return progress kalau user masih tak complete the registration process

/api/v1/drivers/application-progress

  • 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.
@jourdein
Copy link
Author

CleanShot 2023-01-24 at 22 09 26

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment