Fix bug where tour wouldn't run when registered via /onboard

This commit is contained in:
Eric Schultz 2018-06-08 14:18:52 -05:00
parent aedfea70b5
commit 62b45b07b3

View file

@ -11,6 +11,7 @@ import {FormattedMessage, injectIntl, InjectedIntlProps} from 'react-intl';
import {WizardState} from "../common/wizard/wizard_state"; import {WizardState} from "../common/wizard/wizard_state";
import UserInfoPanel, * as UserInfo from "./UserInfoPanel"; import UserInfoPanel, * as UserInfo from "./UserInfoPanel";
import { import {
Nonprofit,
NonprofitApi, NonprofitApi,
PostNonprofit, PostNonprofit,
ValidationErrorsException ValidationErrorsException
@ -27,7 +28,15 @@ import * as UserInfoForm from "./UserInfoForm";
export interface RegistrationWizardProps { export interface RegistrationWizardProps {
ApiManager?: ApiManager ApiManager?: ApiManager
} }
const setTourCookies = (nonprofit:Nonprofit) => {
document.cookie = `tour_dashboard=${nonprofit.id};path=/`
document.cookie = `tour_campaign=${nonprofit.id};path=/`
document.cookie = `tour_event=${nonprofit.id};path=/`
document.cookie = `tour_profile=${nonprofit.id};path=/`
document.cookie = `tour_transactions=${nonprofit.id};path=/`
document.cookie = `tour_supporters=${nonprofit.id};path=/`
document.cookie = `tour_subscribers=${nonprofit.id};path=/`
}
export class RegistrationPageForm extends HoudiniForm { export class RegistrationPageForm extends HoudiniForm {
converter: StaticFormToErrorAndBackConverter<PostNonprofit> converter: StaticFormToErrorAndBackConverter<PostNonprofit>
@ -71,7 +80,7 @@ export class RegistrationPageForm extends HoudiniForm {
try { try {
let r = await this.nonprofitApi.postNonprofit(input) let r = await this.nonprofitApi.postNonprofit(input)
setTourCookies(r)
await this.signinApi.postLogin({email: input.user.email, password: input.user.password}) await this.signinApi.postLogin({email: input.user.email, password: input.user.password})
window.location.href = `/nonprofits/${r.id}/dashboard` window.location.href = `/nonprofits/${r.id}/dashboard`