Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const authSignup = (username, email, password, confirm_password) => {
- return dispatch => {
- dispatch(authStart());
- axios.post('http://127.0.0.1:8000/rest-auth/registration/', {
- username: username,
- email: email,
- password: password,
- confirm_password: confirm_password
- })
- .then(res => {
- const token = res.data.key;
- const expirationDate = new Date(new Date().getTime() + 3600 * 1000);
- localStorage.setItem('token', token);
- localStorage.setItem('expirationDate', expirationDate);
- dispatch(authSuccess(token));
- dispatch(checkAuthTimeout(3600));
- })
- .catch(err => {
- dispatch(authFail(err))
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement