Skip to content
Snippets Groups Projects
Commit 31d43396 authored by Zara Mudassar's avatar Zara Mudassar
Browse files

Delete apiutil.js

parent 27652267
No related branches found
No related tags found
1 merge request!19Item card
Pipeline #176216 passed with stages
in 1 minute and 24 seconds
import axios from "axios";
import { tokenHeader } from "./token-utils";
const API_URL = process.env.VUE_APP_BASEURL;
export function doLogin(loginRequest) {
const auth = {isLoggedIn: false, token: ""};
return axios
.post(API_URL + "login/authentication", loginRequest)
.then((response) => {
auth.isLoggedIn = true;
auth.token = response.data;
return auth;
})
.catch((error) => {
console.log(error.response);
return auth;
});
}
export function registerUser(registerInfo) {
return axios
.post(API_URL + "register", {
email: registerInfo.email,
firstName: registerInfo.firstName,
lastname: registerInfo.lastname,
password: registerInfo.password,
address: registerInfo.address,
})
.then((response) => {
return response;
})
.catch((err) => console.log(err));
}
export async function getUser(userid) {
return axios
.get(API_URL + "users/" + userid + "/profile", {
headers: tokenHeader(),
})
.then((response) => {
return response.data;
})
.catch((error) => {
console.error(error);
});
}
export function getRenterRating(userid) {
return axios
.get(API_URL + "users/" + userid + "", {
headers: tokenHeader(),
})
.then((response) => {
return response.data;
})
.catch((error) => {
console.error(error);
});
}
export function getOwnerRating(userid) {
return axios
.get(API_URL + "users/" + userid + "", {
headers: tokenHeader(),
})
.then((response) => {
return response.data;
})
.catch((error) => {
console.error(error);
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment