Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Self Service: fix login issue #67

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions src/topcoder-micro-frontends-navbar-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
setNotificationPlatform,
disableNavigationForRoute,
enableNavigationForRoute,
updateUserProfile,
} from "./utils/exports";

import { login, businessLogin, logout } from "./utils";
Expand Down Expand Up @@ -51,5 +52,6 @@ export {
setNotificationPlatform,
disableNavigationForRoute,
enableNavigationForRoute,
updateUserProfile,
PLATFORM,
};
16 changes: 16 additions & 0 deletions src/utils/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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));
};
5 changes: 2 additions & 3 deletions src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import _ from "lodash";
import moment from "moment";
import config from "../../config";
import { PLATFORM_DOMAIN } from "../constants";

/**
* Generate Logout URL
Expand Down Expand Up @@ -35,7 +34,7 @@ export const getBusinessLoginUrl = () =>
*/
export const getSelfServiceLoginUrl = () =>
`${config.URL.AUTH}?retUrl=${encodeURIComponent(
`${PLATFORM_DOMAIN}/self-service`
`${window.location.origin}/self-service`
)}&regSource=tcBusiness&mode=login`;

/**
Expand All @@ -45,7 +44,7 @@ export const getSelfServiceLoginUrl = () =>
*/
export const getSelfServiceSignupUrl = () =>
`${config.URL.AUTH}?retUrl=${encodeURIComponent(
`${PLATFORM_DOMAIN}/self-service`
`${window.location.origin}/self-service`
)}&regSource=tcBusiness&mode=signUp`;

/**
Expand Down