Skip to content

Commit 6dd0c5b

Browse files
authored
Merge pull request #13 from Code-4-Community/login-signup
Add login and signup pages
2 parents 8d042f5 + e88b93a commit 6dd0c5b

File tree

19 files changed

+219
-43
lines changed

19 files changed

+219
-43
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"error",
1818
{
1919
"singleQuote": true,
20-
"endOfLine":"auto"
20+
"endOfLine": "auto"
2121
}
2222
],
2323
"react/no-unescaped-entities": 0

.github/pull_request_template.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ What benefit does this bring to the end user? Or, what benefit does this bring t
66

77
## This PR
88

9-
Describe the changes required and any implementation choices you made to give context to reviewers.
9+
Describe the changes required and any implementation choices you made to give context to reviewers.
1010

1111
## Screenshots
1212

13-
Provide screenshots of any new components, styling changes, or pages.
13+
Provide screenshots of any new components, styling changes, or pages.
1414

1515
## Verification Steps
1616

17-
What steps did you take to verify your changes work? These should be clear enough for someone to be able to clone the branch and follow the steps themselves.
17+
What steps did you take to verify your changes work? These should be clear enough for someone to be able to clone the branch and follow the steps themselves.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ node_js:
33
- 13.12.0
44
script:
55
- npm run travis
6-
after_success:
6+
after_success:
77
- npm run coveralls

craco.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ module.exports = {
1515
},
1616
},
1717
],
18-
};
18+
};

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@testing-library/react": "^9.5.0",
1212
"@testing-library/user-event": "^7.2.1",
1313
"@types/jest": "^24.9.1",
14-
"@types/node": "^12.12.50",
14+
"@types/node": "^12.19.1",
1515
"@types/react-dom": "^16.9.8",
1616
"@types/react-helmet": "^6.0.0",
1717
"@types/react-router-dom": "^5.1.5",

src/App.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@
22
// need to use !important to overwrite .ant-layout
33
min-height: 100vh !important;
44
}
5+
6+
.content-container {
7+
display: block;
8+
padding: 24px;
9+
max-width: 960px;
10+
margin: auto;
11+
}

src/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { Helmet } from 'react-helmet';
66
import 'antd/dist/antd.css';
77
import './App.less';
88
import Home from './containers/home/Home';
9+
import Signup from './containers/signup/Signup';
10+
import Login from './containers/login/Login';
911
import BlockTemplate from './containers/template-1-col-block/Template';
1012
import GridTemplate from './containers/template-24-col-grid/Template';
1113

@@ -34,6 +36,8 @@ const App: React.FC = () => {
3436
<Route path="/" exact component={Home} />
3537
<Route path="/block-template" exact component={BlockTemplate} />
3638
<Route path="/grid-template" exact component={GridTemplate} />
39+
<Route path="/login" exact component={Login} />
40+
<Route path="/signup" exact component={Signup} />
3741
<Route path="*" exact component={NotFound} />
3842
</Switch>
3943
</div>

src/auth/authAPI.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ interface LoginRequest {
1212
readonly password: string;
1313
}
1414

15+
interface SignupRequest {
16+
readonly username: string;
17+
readonly email: string;
18+
readonly password: string;
19+
readonly firstName: string;
20+
readonly lastName: string;
21+
}
22+
1523
export const login = async (user: LoginRequest) =>
1624
Axios.post(ROUTES.LOGIN, user).then((response) => {
1725
Token.setAccessToken(response.data.accessToken);
1826
Token.setRefreshToken(response.data.refreshToken);
1927
});
2028

21-
export const signup = async (user: LoginRequest) =>
29+
export const signup = async (user: SignupRequest) =>
2230
Axios.post(ROUTES.SIGNUP, user).then((response) => {
2331
Token.setAccessToken(response.data.accessToken);
2432
Token.setRefreshToken(response.data.refreshToken);

src/auth/axios.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import tokenService from './token';
2-
import requestInterceptor from './axios';
2+
import { requestInterceptor } from './axios';
33

44
describe('Request Interceptor Tests', () => {
55
/*

0 commit comments

Comments
 (0)