Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as api from './api.js';
- const host = 'http://localhost:3030';
- //api.settings.host = host;
- export const login = api.login;
- export const register = api.register;
- export const logout = api.logout;
- export async function getAllListings() {
- return await api.get(host + '/data/cars?sortBy=_createdOn%20desc');
- }
- export async function getListingById(id) {
- return await api.get(host + '/data/cars/' + id);
- }
- export async function createListing(listing) {
- return await api.post(host + '/data/cars', listing)
- }
- export async function updateListing(id, listing) {
- return await api.put(host + '/data/cars/' + id, listing);
- }
- export async function getMyListings(userId) {
- return await api.get(host + `/data/cars?where=_ownerId%3D%22${userId}%22&sortBy=_createdOn%20desc`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement