Skip to content

Commit dd0dc77

Browse files
Merge pull request #132 from intelops/add-validations
Add validations on home page for fetching details
2 parents 3cfceae + 23572df commit dd0dc77

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
/.idea
1010
/core/coverage.out
1111
/app/coverage
12-
openapitools.json
12+
openapitools.json
13+
/core/openapitools.json

core/.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
**/*.log
33
Dockerfile
44
.git
5-
.gitignore
5+
.gitignore
6+
openapitools.json

ui/src/components/home/home.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ export const Home = () => {
4444
const dispatch = useAppDispatch();
4545

4646
useEffect(() => {
47-
const currentProjectDetails: string = getCurrentProjectDetails();
48-
if (currentProjectDetails) {
49-
const userNameAndProjectAndVersion = currentProjectDetails.split("###");
50-
const getProjectRequest: GetProjectRequest = {
51-
id: userNameAndProjectAndVersion[1]
52-
};
53-
dispatch(existsProjectAsync(getProjectRequest));
54-
const getCurrentProjectContext: GetCurrentContextRequest = {};
55-
dispatch(getCurrentContextAsync(getCurrentProjectContext));
47+
if (authData.login) {
48+
const currentProjectDetails: string = getCurrentProjectDetails();
49+
if (currentProjectDetails) {
50+
const userNameAndProjectAndVersion = currentProjectDetails.split("###");
51+
const getProjectRequest: GetProjectRequest = {
52+
id: userNameAndProjectAndVersion[1]
53+
};
54+
dispatch(existsProjectAsync(getProjectRequest));
55+
const getCurrentProjectContext: GetCurrentContextRequest = {};
56+
dispatch(getCurrentContextAsync(getCurrentProjectContext));
57+
}
5658
}
5759
}, [dispatch]);
5860

0 commit comments

Comments
 (0)