mirror of
https://github.com/ditkrg/AuthorizationServerDemos.git
synced 2026-01-23 07:27:03 +00:00
22 lines
556 B
JavaScript
22 lines
556 B
JavaScript
import axios from "axios";
|
|
|
|
async function getVehiclesFromApi(access_token) {
|
|
const response = await axios.get(`http://localhost:8000/real-estate`, {
|
|
headers: { Authorization: `Bearer ${access_token}` },
|
|
});
|
|
|
|
return response.data;
|
|
}
|
|
|
|
async function registerVehicle(vehicle, access_token) {
|
|
console.log(vehicle);
|
|
const response = await axios.post(
|
|
`http://localhost:8000/real-estate`,
|
|
vehicle,
|
|
{ headers: { Authorization: `Bearer ${access_token}` } }
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
export { getVehiclesFromApi, registerVehicle };
|