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

Commit 0e435d1

Browse files
authored
Merge pull request #73 from topcoder-platform/dev
feat: add regSource to signup url
2 parents 723b97a + 47e06aa commit 0e435d1

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ workflows:
7474
branches:
7575
only:
7676
- dev
77-
- feat/onboarding-app
77+
- feat/regsource
7878

7979
# Production builds are exectuted only on tagged commits to the
8080
# master branch.

src/constants/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ export const PLATFORM_DOMAIN =
4848
process.env.APPENV === "local"
4949
? window.location.origin
5050
: config.URL.PLATFORM_DOMAIN;
51+
52+
export const PATH_REG_SOURCE_MAP = [
53+
{ path: "/earn/gigs", regSource: "gigs" },
54+
{ path: "/earn/find/challenges", regSource: "challenges" },
55+
];

src/utils/index.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import _ from "lodash";
22
import moment from "moment";
33
import config from "../../config";
4+
import { PATH_REG_SOURCE_MAP } from "../constants";
45

56
/**
67
* Generate Logout URL
@@ -13,10 +14,19 @@ export const getLogoutUrl = () =>
1314
/**
1415
* Generate Login URL
1516
*/
16-
export const getLoginUrl = () =>
17-
`${config.URL.AUTH}?retUrl=${encodeURIComponent(
17+
export const getLoginUrl = () => {
18+
let regSource = null;
19+
const pathname = window.location.pathname;
20+
for (const { path, regSource: source } of PATH_REG_SOURCE_MAP) {
21+
if (pathname.indexOf(path) != -1) {
22+
regSource = source;
23+
}
24+
}
25+
26+
return `${config.URL.AUTH}?retUrl=${encodeURIComponent(
1827
window.location.href.match(/[^?]*/)[0]
19-
)}`;
28+
)}${regSource != null ? "&regSource=" + regSource : ""}`;
29+
};
2030

2131
/**
2232
* Generate Business Login URL

0 commit comments

Comments
 (0)