Răsfoiți Sursa

Update API endpoints and fix boot/router import

Change API paths to the new route format:
- city: /city/state/:id and /city/country/:id
- state: /state/country/:id
- permissions: /permissions/user/type and /permissions/user/type/guest
- user: /user/current/auth and /user/all/types

Pass router into axios boot for the response interceptor and remove
useRouter import

Fix typo in country dialog placeholder ("Nome completo do pais")
Denis 2 luni în urmă
părinte
comite
c817b62388

+ 2 - 2
src/api/city.js

@@ -13,12 +13,12 @@ export const getCities = async () => {
 };
 
 export const getCityByState = async (stateId) => {
-  const { data } = await api.get(`/city-state/${stateId}`);
+  const { data } = await api.get(`/city/state/${stateId}`);
   return data.payload;
 };
 
 export const getCityByCountry = async (countryId) => {
-  const { data } = await api.get(`/city-country/${countryId}`);
+  const { data } = await api.get(`/city/country/${countryId}`);
   return data.payload;
 };
 

+ 2 - 2
src/api/permission.js

@@ -1,11 +1,11 @@
 import api from "src/api";
 
 export const getGuestPermissions = async () => {
-  const { data } = await api.get("/permissions-by-type/guest");
+  const { data } = await api.get("/permissions/user/type/guest");
   return data.payload;
 };
 
 export const getUserPermissions = async () => {
-  const { data } = await api.get("/permissions-by-type");
+  const { data } = await api.get("/permissions/user/type");
   return data.payload;
 };

+ 1 - 1
src/api/state.js

@@ -13,7 +13,7 @@ export const getStates = async () => {
 }
 
 export const getStateByCountry = async (countryId) => {
-  const { data } = await api.get(`/state-country/${countryId}`);
+  const { data } = await api.get(`/state/country/${countryId}`);
   return data.payload;
 }
 

+ 2 - 2
src/api/user.js

@@ -1,7 +1,7 @@
 import api from "src/api";
 
 export const getUser = async () => {
-  const { data } = await api.get("/user/me");
+  const { data } = await api.get("/user/current/auth");
   return data.payload;
 };
 
@@ -26,6 +26,6 @@ export const deleteUser = async (id) => {
 };
 
 export const userTypes = async () => {
-  const { data } = await api.get("/user-types");
+  const { data } = await api.get("/user/all/types");
   return data.payload;
 };

+ 2 - 3
src/boot/axios.js

@@ -1,7 +1,6 @@
 import { defineBoot } from "#q-app/wrappers";
 import { Cookies, Notify } from "quasar";
 import axios from "axios";
-import { useRouter } from "vue-router";
 import { userStore } from "src/stores/user";
 
 const api = axios.create({
@@ -105,10 +104,10 @@ const successInterceptor = (response) => {
   return response;
 };
 
-export default defineBoot(({ app }) => {
+export default defineBoot(({ app, router }) => {
   api.interceptors.response.use(
     (response) => successInterceptor(response),
-    (error) => errorInterceptor(error, useRouter()),
+    (error) => errorInterceptor(error, router),
   );
 
   // for use inside Vue files (Options API) through this.$axios and this.$api

+ 1 - 1
src/pages/country/components/AddEditCountryDialog.vue

@@ -8,7 +8,7 @@
             v-model="form.name"
             v-model:error="validationErrors.name"
             :label="$t('common.terms.name')"
-            :placeholder="'Nome comple do pais'"
+            :placeholder="'Nome completo do pais'"
             :rules="[inputRules.required]"
             class="col-md-6 col-12"
           />