Jul 27, 2022
0
Level 6
what is the best approach to have 'services' folder on vuejs
HI, i wonder how i could manage my services files, right now i have this way: http-client.js | my base axios config
import axios from "axios";
const httpClient = axios.create({
baseURL: "/api", // required to handle the CSRF token
withCredentials: true,
});
export default httpClient;
roles-service.js | example of my file
import httpClient from "./http-client";
export default function () {
const getRoles = async ()=> {
const { data } = await httpClient.get("roles");
return data;
};
return {
getRoles,
};
}
Please or to participate in this conversation.