Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
seng513-202401-group-13
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Junyi Li
seng513-202401-group-13
Commits
b2e33109
Commit
b2e33109
authored
1 year ago
by
Junyi Li
Browse files
Options
Downloads
Patches
Plain Diff
fix: redirect user to login page if they are not logged in
parent
51335dc7
Branches
main
Tags
Release_1.0
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/components/Navbar.js
+1
-2
1 addition, 2 deletions
client/components/Navbar.js
client/pages/create.js
+7
-1
7 additions, 1 deletion
client/pages/create.js
with
8 additions
and
3 deletions
client/components/Navbar.js
+
1
−
2
View file @
b2e33109
...
...
@@ -62,8 +62,7 @@ const Navbar = () => {
<
div
className
=
'
d-flex
'
>
<
Link
className
=
'
nav-link p-2 px-5 border-end border-2 border-secondary
'
href
=
'
/
'
>
Home
<
/Link
>
<
Link
className
=
'
nav-link p-2 px-5 border-end border-2 border-secondary
'
href
=
'
/browsecomm
'
>
Browse
<
/Link
>
<
Link
className
=
'
nav-link p-2 px-5 border-end border-2 border-secondary
'
href
=
'
/create
'
>
Create
<
/Link
>
<
/div
>
{
user
&&
<
Link
className
=
'
nav-link p-2 px-5 border-end border-2 border-secondary
'
href
=
'
/create
'
>
Create
<
/Link>} </
div
>
<
div
className
=
'
d-flex justify-content-center align-items-center
'
>
{
user
&&
<
div
className
=
'
nav-link p-2 px-3
'
href
=
'
/login
'
>
{
user
.
username
}
<
/div>
}
{
user
&&
...
...
This diff is collapsed.
Click to expand it.
client/pages/create.js
+
7
−
1
View file @
b2e33109
import
React
,
{
useState
}
from
'
react
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
{
Formik
,
Field
,
Form
}
from
'
formik
'
;
import
Banner
from
'
../components/Banner
'
;
import
Navbar
from
'
../components/Navbar
'
;
...
...
@@ -33,6 +33,12 @@ export default function create() {
router
.
push
(
"
/browsecomm
"
)
}
useEffect
(()
=>
{
const
user
=
getUserFromToken
();
if
(
!
user
)
router
.
push
(
"
/login
"
);
},
[]);
return
(
<
div
className
=
{
styles
.
pageContainer
}
>
<
Banner
title
=
"
Create Community
"
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment