diff --git a/config/dev.js b/config/dev.js index d434242..5ab57bf 100644 --- a/config/dev.js +++ b/config/dev.js @@ -5,7 +5,7 @@ module.exports = { TC_NOTIFICATION_URL: "https://api.topcoder-dev.com/v5/notifications", CONNECT_DOMAIN: "https://connect.topcoder-dev.com", COMMUNITY_DOMAIN: "https://www.topcoder-dev.com", - PLATFORM_DOMAIN: "https://local.topcoder-dev.com", + PLATFORM_DOMAIN: "https://platform.topcoder-dev.com", TAAS_APP: "https://platform.topcoder-dev.com/taas/myteams", }, API: { diff --git a/src/topcoder-micro-frontends-navbar-app.js b/src/topcoder-micro-frontends-navbar-app.js index 31fc2ce..a9e02f8 100644 --- a/src/topcoder-micro-frontends-navbar-app.js +++ b/src/topcoder-micro-frontends-navbar-app.js @@ -20,6 +20,7 @@ import { setNotificationPlatform, disableNavigationForRoute, enableNavigationForRoute, + updateUserProfile, } from "./utils/exports"; import { login, businessLogin, logout } from "./utils"; @@ -51,5 +52,6 @@ export { setNotificationPlatform, disableNavigationForRoute, enableNavigationForRoute, + updateUserProfile, PLATFORM, }; diff --git a/src/utils/exports.js b/src/utils/exports.js index a5fd63d..881efc8 100644 --- a/src/utils/exports.js +++ b/src/utils/exports.js @@ -6,6 +6,7 @@ import _ from "lodash"; import { bindActionCreators } from "redux"; import store from "../store"; +import actions from "../actions"; import menuActions from "../actions/menu"; import authActions from "../actions/auth"; import notificationActions from "../actions/notifications"; @@ -77,3 +78,18 @@ export const getAuthUserTokens = () => { }); } }; + +/** + * Updates user profile + */ +export const updateUserProfile = (firstName, lastName) => { + const { auth } = store.getState(); + + const newProfile = { + ...auth.profile, + firstName, + lastName, + }; + + store.dispatch(actions.auth.loadProfile(newProfile || null)); +}; diff --git a/src/utils/index.js b/src/utils/index.js index 1f7ee5c..c4d4c9a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,7 +1,6 @@ import _ from "lodash"; import moment from "moment"; import config from "../../config"; -import { PLATFORM_DOMAIN } from "../constants"; /** * Generate Logout URL @@ -35,7 +34,7 @@ export const getBusinessLoginUrl = () => */ export const getSelfServiceLoginUrl = () => `${config.URL.AUTH}?retUrl=${encodeURIComponent( - `${PLATFORM_DOMAIN}/self-service` + `${window.location.origin}/self-service` )}®Source=tcBusiness&mode=login`; /** @@ -45,7 +44,7 @@ export const getSelfServiceLoginUrl = () => */ export const getSelfServiceSignupUrl = () => `${config.URL.AUTH}?retUrl=${encodeURIComponent( - `${PLATFORM_DOMAIN}/self-service` + `${window.location.origin}/self-service` )}®Source=tcBusiness&mode=signUp`; /**