Skip to content

Commit 7fed466

Browse files
Linda PengLinda Peng
authored andcommitted
verify email skeleton
1 parent 806f8c8 commit 7fed466

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

src/App.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Profile from './components/Profile';
1414
import SubmitResource from './components/Resources/submitResource';
1515
import ResourcePage from './components/Resources/ResourcePage.js';
1616
import PrivateRoute from './PrivateRoute';
17+
import VerifyEmail from './components/Auth/VerifyEmail';
1718

1819
function App() {
1920
const [authTokens, setAuthTokens] = useState(
@@ -44,6 +45,10 @@ function App() {
4445
<Route path="/signup">
4546
<SignUpForm />
4647
</Route>
48+
<Route
49+
path="/verify-email/:key"
50+
render={matchProps => <VerifyEmail matchProps={matchProps} />}
51+
/>
4752
<Route path="/coworking">
4853
<Coworking />
4954
</Route>

src/components/Auth/VerifyEmail.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { useQuery } from 'react-query';
4+
import { verifyEmail } from '../../utils/queries';
5+
6+
function VerifyEmail({ matchProps }) {
7+
console.log(matchProps);
8+
const key = matchProps.match.params.key;
9+
console.log(key);
10+
const { isLoading, data, error } = useQuery(['key', key], verifyEmail);
11+
console.log(isLoading);
12+
console.log(data);
13+
console.log(error);
14+
return <h1>verify email</h1>;
15+
}
16+
17+
VerifyEmail.propTypes = {
18+
matchProps: PropTypes.object,
19+
};
20+
21+
export default VerifyEmail;

src/utils/queries.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from 'axios';
22

3-
const API_URL = '/api/v1';
3+
const API_URL = 'http://localhost:8000/api/v1';
44

55
const getResource = async (_key, id) => {
66
const { data } = await axios.get(`${API_URL}/resources/${id}`);
@@ -12,4 +12,11 @@ const getResources = async searchTerm => {
1212
return data;
1313
};
1414

15-
export { getResource, getResources };
15+
const verifyEmail = async (_key, apiKey) => {
16+
const { data } = await axios.post(`${API_URL}/registration/verify-email`, {
17+
key: apiKey,
18+
});
19+
return data;
20+
};
21+
22+
export { getResource, getResources, verifyEmail };

0 commit comments

Comments
 (0)