feat: implement plan upgrade logic with prorated pricing and MercadoPago integration
This commit is contained in:
@@ -54,20 +54,23 @@ export default function Login(props: LoginProps) {
|
||||
SessionToken.setToken(userSession.userToken);
|
||||
SessionInfo.setLoginState("success");
|
||||
alert.showSuccess(msg);
|
||||
manageLoginActions(userSession);
|
||||
};
|
||||
|
||||
const manageLoginActions = () => {
|
||||
const toUrl = process.env.NEXT_PUBLIC_DEFAULT_PATH_AFTER_LOGIN || "/";
|
||||
const manageLoginActions = (session: ISession = SessionInfo) => {
|
||||
if (loginAction.action !== LOGIN_ACTIONS.NONE) {
|
||||
goTo(loginAction.url);
|
||||
loginAction.clear();
|
||||
} else {
|
||||
if (SessionInfo.subscription && SessionInfo.subscription.plan) {
|
||||
const hasPlan = Boolean(session.subscription?.plan?.id);
|
||||
const hasOrganization = Object.keys(session.organizationSubscriptions || {}).length > 0;
|
||||
|
||||
if (hasPlan && hasOrganization) {
|
||||
goTo("/landing/dashboard");
|
||||
return;
|
||||
}
|
||||
|
||||
goTo(toUrl);
|
||||
goTo("/landing/my-appointments");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user