You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
1.2 KiB

import { post } from "./baseApi";
/**
* Function wrapping POST request for user registration
* @param {string} email - email of user to register
* @param {string} password1 - password of user to register
* @param {string} password2 - server side password confirmation
*/
export function registerUser(email, password1, password2) {
return post("/rest-auth/registration/", {
email,
password1,
password2
}).then(resp => Promise.resolve(resp));
}
/**
* Function wrapping POST request for email validation
* @param {string} emailKey - key for email validation
*/
export function verifyEmail(emailKey) {
return post("/rest-auth/registration/verify-email/", {
key: emailKey
}).then(resp => Promise.resolve(resp));
}
/**
* Function wrapping POST request for user login
* @param {string} email - email of user to login
* @param {string} password - password of user to login
*/
export function loginUser(email, password) {
return post("/rest-auth/login/", { email, password }).then(resp =>
Promise.resolve(resp)
);
}
/**
* Function wrapping POST request for user logout
*/
export function logoutUser() {
return post("/rest-auth/logout/").then(resp => Promise.resolve(resp));
}