Browse Source
feat: implement Flutter bridge for cross-platform authentication and state management
front-test-2
feat: implement Flutter bridge for cross-platform authentication and state management
front-test-2
15 changed files with 252 additions and 127 deletions
-
4src/app/candidate-contact/page.tsx
-
23src/app/finding-match/page.tsx
-
32src/app/intro/page.tsx
-
2src/app/layout.tsx
-
4src/app/new-match/page.tsx
-
97src/app/new-match/profile/page.tsx
-
98src/app/request-accepted/page.tsx
-
27src/app/request-sent/page.tsx
-
2src/components/sliders/slider-page.tsx
-
6src/components/ui/sticky-header.tsx
-
5src/hooks/marriage/types.ts
-
2src/hooks/marriage/use-case-respond.ts
-
3src/lib/auth-bridge.ts
-
61src/lib/get-submit-path.ts
-
3src/lib/http.ts
@ -0,0 +1,61 @@ |
|||
import type { MarriageProfileResponse } from "@/hooks/marriage/types"; |
|||
|
|||
export function getSubmitPath(profile: MarriageProfileResponse | undefined) { |
|||
if (!profile) { |
|||
return "/intro"; |
|||
} |
|||
|
|||
const isMatchSubmitted = |
|||
typeof window !== "undefined" && |
|||
localStorage.getItem("match_submitted") === "true"; |
|||
|
|||
const activeCase = profile.active_case; |
|||
const isInCase = profile.status === "in_case" || Boolean(activeCase); |
|||
|
|||
if (isInCase && activeCase) { |
|||
const caseStatus = activeCase.status; |
|||
const myAction = activeCase.my_action; |
|||
|
|||
if (caseStatus === "payment_done" || caseStatus === "finalized") { |
|||
return "/candidate-contact"; |
|||
} |
|||
|
|||
if (caseStatus === "payment_pending" || caseStatus === "female_accepted") { |
|||
return "/request-accepted"; |
|||
} |
|||
|
|||
if (caseStatus === "male_accepted") { |
|||
if (myAction === "pending") { |
|||
return "/new-match"; |
|||
} |
|||
return "/request-sent"; |
|||
} |
|||
|
|||
if (caseStatus === "introduced") { |
|||
if (myAction === "pending") { |
|||
return "/new-match"; |
|||
} |
|||
return "/finding-match"; |
|||
} |
|||
|
|||
return "/new-match"; |
|||
} |
|||
|
|||
if (profile.status === "pending_onboarding") { |
|||
return "/terms"; |
|||
} |
|||
|
|||
if (profile.status === "pending_info" && !isMatchSubmitted) { |
|||
return "/questions-list"; |
|||
} |
|||
|
|||
if (profile.status === "waiting" || isMatchSubmitted) { |
|||
return "/finding-match"; |
|||
} |
|||
|
|||
if (profile.status === "matched") { |
|||
return "/candidate-contact"; |
|||
} |
|||
|
|||
return "/terms"; |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue