Skip to content

Commit 68bd914

Browse files
committed
Fix UI, Fix NotFound redirect
1 parent 862a2a0 commit 68bd914

File tree

5 files changed

+37
-14
lines changed

5 files changed

+37
-14
lines changed

frontend/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
"dependencies": {
66
"@material-ui/core": "^4.0.0-rc.0",
77
"@material-ui/icons": "^4.0.0-rc.0",
8-
"@types/jest": "24.0.13",
9-
"@types/node": "12.0.2",
10-
"@types/react": "16.8.18",
11-
"@types/react-dom": "16.8.4",
12-
"@types/react-router-dom": "^4.3.3",
138
"apollo-cache-inmemory": "^1.6.0",
149
"apollo-client": "^2.6.0",
1510
"apollo-link": "^1.2.11",
@@ -53,6 +48,11 @@
5348
]
5449
},
5550
"devDependencies": {
56-
"@types/lodash.get": "^4.4.6"
51+
"@types/lodash.get": "^4.4.6",
52+
"@types/jest": "24.0.13",
53+
"@types/node": "12.0.2",
54+
"@types/react": "16.8.18",
55+
"@types/react-dom": "16.8.4",
56+
"@types/react-router-dom": "^4.3.3"
5757
}
5858
}

frontend/src/components/NotFound.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import React from 'react'
2+
import { Redirect } from 'react-router'
23

34
const NotFound: React.FC = (props) => {
4-
return <div>NotFound</div>
5+
if (!localStorage.getItem('token')) return <Redirect to="/login" />
6+
7+
return <div>Not Found</div>
58
}
69

710
export default NotFound

frontend/src/components/auth/Login.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,23 @@ const Login: React.FC<Props> = () => {
119119
value={values.password}
120120
/>
121121
{errors.password && touched.password && errors.password}
122-
<Button type="submit" disabled={isSubmitting}>
123-
Submit
124-
</Button>
122+
<Box clone my={2}>
123+
<Button
124+
variant="contained"
125+
color="primary"
126+
type="submit"
127+
disabled={isSubmitting}
128+
>
129+
Submit
130+
</Button>
131+
</Box>
125132
</form>
126133
</Box>
127134
)}
128135
</Formik>
136+
<Box display="flex" flexDirection="column" alignItems="flex-end">
137+
<Button onClick={() => history.push('/signup')}>Signup</Button>
138+
</Box>
129139
{error}
130140
</Paper>
131141
</Box>

frontend/src/components/auth/Signup.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,23 @@ const Signup: React.FC<Props> = () => {
134134
value={values.password}
135135
/>
136136
{errors.password && touched.password && errors.password}
137-
<Button type="submit" disabled={isSubmitting}>
138-
Submit
139-
</Button>
137+
<Box clone my={2}>
138+
<Button
139+
variant="contained"
140+
color="primary"
141+
type="submit"
142+
disabled={isSubmitting}
143+
>
144+
Submit
145+
</Button>
146+
</Box>
140147
</form>
141148
</Box>
142149
)}
143150
</Formik>
151+
<Box display="flex" flexDirection="column" alignItems="flex-end">
152+
<Button onClick={() => history.push('/login')}>Login</Button>
153+
</Box>
144154
{error}
145155
</Paper>
146156
</Box>

frontend/src/components/layout/AuthLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const AuthLayout: React.FC<Props> = ({ children }) => {
5656
useEffect(() => {
5757
window.addEventListener('resize', resize)
5858
resize()
59-
}, [resize])
59+
}, []) // eslint-disable-line
6060

6161
const checkIsMobile = () => (window.innerWidth < 600 ? true : false)
6262

0 commit comments

Comments
 (0)