Skip to content

Commit 31abf6a

Browse files
Linda PengLinda Peng
authored andcommitted
Create a new register component and verify email function
1 parent 7fed466 commit 31abf6a

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/App.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Home from './components/Home';
99
import Nav from './components/Nav';
1010
import LoginForm from './components/Auth/LoginForm.js';
1111
import SignUpForm from './components/Auth/SignUpForm.js';
12+
import Register from './components/Auth/Register.js';
1213
import Coworking from './components/Coworking';
1314
import Profile from './components/Profile';
1415
import SubmitResource from './components/Resources/submitResource';
@@ -45,6 +46,9 @@ function App() {
4546
<Route path="/signup">
4647
<SignUpForm />
4748
</Route>
49+
<Route path="/register">
50+
<Register />
51+
</Route>
4852
<Route
4953
path="/verify-email/:key"
5054
render={matchProps => <VerifyEmail matchProps={matchProps} />}

src/utils/queries.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,25 @@ const getResources = async searchTerm => {
1212
return data;
1313
};
1414

15-
const verifyEmail = async (_key, apiKey) => {
16-
const { data } = await axios.post(`${API_URL}/registration/verify-email`, {
17-
key: apiKey,
15+
const registerUser = async (_key, user) => {
16+
const { username, password1, email, password2 } = user;
17+
const { data } = await axios.post(`${API_URL}/auth/registration`, {
18+
username,
19+
email,
20+
password1,
21+
password2,
1822
});
1923
return data;
2024
};
2125

22-
export { getResource, getResources, verifyEmail };
26+
const verifyEmail = async (_key, apiKey) => {
27+
const { data } = await axios.post(
28+
`${API_URL}/auth/registration/verify-email`,
29+
{
30+
key: apiKey,
31+
}
32+
);
33+
return data;
34+
};
35+
36+
export { getResource, verifyEmail, registerUser };

0 commit comments

Comments
 (0)