Page: Refactor pagecategory service to use axios instead of vuex store

pull/4978/head
Angel Fernando Quiroz Campos 1 year ago
parent 16429423e1
commit 1d1d048428
  1. 8
      assets/vue/components/page/Form.vue
  2. 8
      assets/vue/main.js
  3. 10
      assets/vue/services/pageCategoryService.js
  4. 3
      assets/vue/services/pagecategory.js

@ -122,6 +122,7 @@ import useVuelidate from '@vuelidate/core';
import { required } from '@vuelidate/validators';
import isEmpty from 'lodash/isEmpty';
import { useI18n } from 'vue-i18n';
import pageCategoryService from "../../services/pageCategoryService"
const props = defineProps({
modelValue: {
@ -143,12 +144,9 @@ let locales = ref([]);
let categories = ref([]);
locales.value = window.languages.map(locale => locale.isocode);
store.dispatch('pagecategory/findAll')
.then((response) => {
categories.value = response.map(data => data);
});
const findAllPageCategories = async () => categories.value = await pageCategoryService.findAll()
const currentUser = computed(() => store.getters['security/getUser']);
findAllPageCategories()
watch(
() => props.modelValue,

@ -23,7 +23,6 @@ import userRelUserService from "./services/userreluser"
import calendarEventService from "./services/ccalendarevent"
import toolIntroService from "./services/ctoolintro"
import pageService from "./services/page"
import pageCategoryService from "./services/pagecategory"
import sessionService from "./services/session"
import socialPostService from "./services/socialpost"
@ -102,13 +101,6 @@ store.registerModule(
}),
)
store.registerModule(
"pagecategory",
makeCrudModule({
service: pageCategoryService,
}),
)
store.registerModule(
"session",
makeCrudModule({

@ -0,0 +1,10 @@
import {ENTRYPOINT} from "../config/entrypoint"
import axios from "axios"
export default {
findAll: async () => {
const response = await axios.get(ENTRYPOINT + 'page_categories')
return response.data['hydra:member']
},
}

@ -1,3 +0,0 @@
import makeService from './api';
export default makeService('page_categories');
Loading…
Cancel
Save