diff --git a/package.json b/package.json
index 6ef3ce1b0..f8befe05c 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
"email-validator": "^2.0.4",
"font-awesome": "^4.7.0",
"friendly-challenge": "^0.9.2",
- "full-schedule-widget": "^1.1.45",
+ "full-schedule-widget": "^1.1.46",
"gatsby": "^2.32.13",
"gatsby-cli": "^2.11.5",
"gatsby-image": "^2.3.1",
diff --git a/src/routes/authorization-callback-route.js b/src/routes/authorization-callback-route.js
index 8554417f3..b534b4d3b 100644
--- a/src/routes/authorization-callback-route.js
+++ b/src/routes/authorization-callback-route.js
@@ -16,9 +16,10 @@ import URI from "urijs"
import { navigate } from '@reach/router'
import { connect } from 'react-redux';
import { AbstractAuthorizationCallbackRoute } from "openstack-uicore-foundation/lib/components";
-import { getUserProfile} from '../actions/user-actions'
-import {IDP_BASE_URL, OAUTH2_CLIENT_ID, getEnvVariable} from '../utils/envVariables'
+import { getUserProfile, addToSchedule, removeFromSchedule } from '../actions/user-actions'
+import { IDP_BASE_URL, OAUTH2_CLIENT_ID, getEnvVariable } from '../utils/envVariables'
import HeroComponent from "../components/HeroComponent";
+import { getPendingAction } from '../utils/schedule';
class AuthorizationCallbackRoute extends AbstractAuthorizationCallbackRoute {
@@ -30,7 +31,13 @@ class AuthorizationCallbackRoute extends AbstractAuthorizationCallbackRoute {
this.props.getUserInfo(
'groups, all_affiliations, candidate_profile, election_applications, election_nominations, election_nominations.candidate',
'election_nominations.candidate.first_name, election_nominations.candidate.last_name'
- ).then(() => this.props.getUserProfile().then(() => navigate(URI.decode(backUrl))));
+ ).then(() => this.props.getUserProfile().then(() => navigate(URI.decode(backUrl)))).then(() => {
+ const pendingAction = getPendingAction();
+ if (pendingAction) {
+ const { action, event } = pendingAction;
+ action === 'ADD_EVENT' ? this.props.addToSchedule(event) : this.props.removeFromSchedule(event);
+ }
+ });
}
_redirect2Error(error) {
@@ -39,8 +46,8 @@ class AuthorizationCallbackRoute extends AbstractAuthorizationCallbackRoute {
return null
}
- _render(){
- return
+ _render() {
+ return
}
}
@@ -51,5 +58,7 @@ const mapStateToProps = ({ loggedUserState }) => ({
})
export default connect(mapStateToProps, {
- getUserProfile
+ getUserProfile,
+ addToSchedule,
+ removeFromSchedule
})(AuthorizationCallbackRoute)
diff --git a/src/utils/alerts.js b/src/utils/alerts.js
index 6665da44b..90b4940a2 100644
--- a/src/utils/alerts.js
+++ b/src/utils/alerts.js
@@ -2,6 +2,7 @@ import Swal from "sweetalert2";
import { doLogin } from 'openstack-uicore-foundation/lib/methods'
import URI from "urijs"
+import { savePendingAction } from "./schedule";
export const alertPopup = (title, html, confirmLabel, confirmAction, cancelLabel = 'Dismiss') => {
@@ -30,12 +31,13 @@ export const alertPopup = (title, html, confirmLabel, confirmAction, cancelLabel
})
};
-export const needsLogin = (msg = null) => {
+export const needsLogin = (action, msg = null) => {
const defaultMessage = "Please login in order to build your schedule and add activities during the event";
const login = () => {
let backUrl = window?.location?.href ?? '/a/profile';
let encodedBackUrl = URI.encode(backUrl);
+ if (action) savePendingAction(action);
return doLogin(encodedBackUrl);
}
diff --git a/src/utils/schedule.js b/src/utils/schedule.js
index 75b205ca6..1099e9fc8 100644
--- a/src/utils/schedule.js
+++ b/src/utils/schedule.js
@@ -182,4 +182,14 @@ export const syncFilters = (newFilters, currentFilters) => {
}
});
return newFilters;
+}
+
+export const savePendingAction = (action) => {
+ window.localStorage.setItem('pendingAction', JSON.stringify(action));
+}
+
+export const getPendingAction = () => {
+ const pendingAction = JSON.parse(window.localStorage.getItem('pendingAction'));
+ window.localStorage.removeItem('pendingAction');
+ return pendingAction;
}
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 43e335847..aebdadd5c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10512,10 +10512,10 @@ fstream@^1.0.0, fstream@^1.0.12:
mkdirp ">=0.5 0"
rimraf "2"
-full-schedule-widget@^1.1.45:
- version "1.1.45"
- resolved "https://registry.yarnpkg.com/full-schedule-widget/-/full-schedule-widget-1.1.45.tgz#5298b159777a2dec8f5a50a714c9b85efa44876e"
- integrity sha512-R0rm60xAQ54gpVJYZUQxQgs3GAPOLBc2JuRMpyM/E0dt2rDLPV+dldq7LbVrOTCMtgMOJrMAR+UjnON6mZETtQ==
+full-schedule-widget@^1.1.46:
+ version "1.1.46"
+ resolved "https://registry.yarnpkg.com/full-schedule-widget/-/full-schedule-widget-1.1.46.tgz#7a85472fdaaf3951c299bbcfc287e38fd86e9bbe"
+ integrity sha512-FGCSRrb6AWKlkYWeiqqJmKVfK2nycDbcol19s9NSgKbWAh4QhqBFZOcQLltwDehfAtrlY3xM4BobPZNScNqmiQ==
dependencies:
pure-react-carousel "^1.27.4"