diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-08 09:04:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-08 09:04:06 -0800 |
commit | 4afed4be281b6319c328938e4ed757624a78b13c (patch) | |
tree | 7a7744801c2964a3981c3e3ed1772f8226276c6b /src/state/models/ui/create-account.ts | |
parent | 3a211017d3d972fb442069e38d1b8ff1a2edbd57 (diff) | |
download | voidsky-4afed4be281b6319c328938e4ed757624a78b13c.tar.zst |
Move onboarding state to new persistence + reducer context (#1835)
Diffstat (limited to 'src/state/models/ui/create-account.ts')
-rw-r--r-- | src/state/models/ui/create-account.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/state/models/ui/create-account.ts b/src/state/models/ui/create-account.ts index 1711b530f..39c881db6 100644 --- a/src/state/models/ui/create-account.ts +++ b/src/state/models/ui/create-account.ts @@ -9,6 +9,7 @@ import {cleanError} from 'lib/strings/errors' import {getAge} from 'lib/strings/time' import {track} from 'lib/analytics/analytics' import {logger} from '#/logger' +import {DispatchContext as OnboardingDispatchContext} from '#/state/shell/onboarding' const DEFAULT_DATE = new Date(Date.now() - 60e3 * 60 * 24 * 365 * 20) // default to 20 years ago @@ -90,7 +91,7 @@ export class CreateAccountModel { } } - async submit() { + async submit(onboardingDispatch: OnboardingDispatchContext) { if (!this.email) { this.setStep(2) return this.setError('Please enter your email.') @@ -111,7 +112,7 @@ export class CreateAccountModel { this.setIsProcessing(true) try { - this.rootStore.onboarding.start() // start now to avoid flashing the wrong view + onboardingDispatch({type: 'start'}) // start now to avoid flashing the wrong view await this.rootStore.session.createAccount({ service: this.serviceUrl, email: this.email, @@ -122,7 +123,7 @@ export class CreateAccountModel { /* dont await */ this.rootStore.preferences.setBirthDate(this.birthDate) track('Create Account') } catch (e: any) { - this.rootStore.onboarding.skip() // undo starting the onboard + onboardingDispatch({type: 'skip'}) // undo starting the onboard let errMsg = e.toString() if (e instanceof ComAtprotoServerCreateAccount.InvalidInviteCodeError) { errMsg = |