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

changes for #259 #614

Merged
merged 2 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"form-data": "^3.0.0",
"history": "^4.10.1",
"husky": "^4.2.5",
"js-cookies": "^1.0.4",
"lint-staged": "^10.2.6",
"lodash": "^4.17.15",
"node-sass": "^4.14.1",
Expand Down
17 changes: 13 additions & 4 deletions client/src/pages/Search/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import { useAuth0 } from "../../react-auth0-spa";
import * as OrgService from "../../services/user-org";
import api from "../../services/api";

import Cookies from "js-cookie";

export default function SearchPage() {
const apiClient = api();
const { isLoading, isAuthenticated, user: auth0User } = useAuth0();
const { isLoading, isAuthenticated, user: auth0User, loginWithRedirect } = useAuth0();
const [tab, setTab] = React.useState(TABS.SEARCH);
const [keyword, setKeyword] = React.useState(null);
const [selectedOrg, setSelectedOrg] = React.useState(null);
Expand Down Expand Up @@ -62,9 +64,16 @@ export default function SearchPage() {
}, [keyword]);

const onSelectOrg = (org) => {
OrgService.setSingleOrg(org);
setSelectedOrg(org);
setShouldSelectOrg(false);
const cookie = Cookies.get('auth0.is.authenticated');
if (cookie && cookie === 'true') {
OrgService.setSingleOrg(org);
setSelectedOrg(org);
setShouldSelectOrg(false);
} else {
loginWithRedirect({
redirect_uri: window.location.origin,
});
}
};

let mainContent;
Expand Down