Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const loginServer=(username, password)=> {
- return fetch(`${httpUrl}/companies/login_check`, {
- method: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- username: username,
- password: password,
- })
- }).then((response) => {
- if (!response.ok) {
- throw new Error("User or password is incorrect!");
- }
- return response;
- }).then((response) => response.json()).catch(error => {
- console.log("Login error " + error);
- throw new Error("User or password is incorrect!");
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement