diff --git a/assets/vue/components/links/LinkForm.vue b/assets/vue/components/links/LinkForm.vue index 3476c4ca1f..ca8e660271 100644 --- a/assets/vue/components/links/LinkForm.vue +++ b/assets/vue/components/links/LinkForm.vue @@ -2,7 +2,13 @@
- +
- +
- + @@ -30,9 +42,9 @@
+ @@ -61,7 +79,12 @@
- @@ -76,7 +99,7 @@
-
@@ -90,137 +113,100 @@ - diff --git a/assets/vue/config/entrypoint.js b/assets/vue/config/entrypoint.js index 9676dd3072..f31aaae937 100644 --- a/assets/vue/config/entrypoint.js +++ b/assets/vue/config/entrypoint.js @@ -1,3 +1,3 @@ -export const ENTRYPOINT = window.location.origin+'/api/'; +export const ENTRYPOINT = window.location.origin + '/api/' //export const ENTRYPOINT = process.env.APP_API_PLATFORM_URL; diff --git a/assets/vue/services/linkService.js b/assets/vue/services/linkService.js new file mode 100644 index 0000000000..01e44c2843 --- /dev/null +++ b/assets/vue/services/linkService.js @@ -0,0 +1,34 @@ +import {ENTRYPOINT} from "../config/entrypoint"; +import axios from "axios"; + + +export default { + getLink: async(linkId) => { + const response = await axios.get(ENTRYPOINT + 'links/' + linkId) + return response.data + }, + /** + * @param {Object} data + */ + createLink: async (data) => { + const endpoint = `${ENTRYPOINT}links` + + const response = await axios.post(endpoint, data) + return response.data + }, + /** + * @param {Number} linkId + * @param {Object} data + */ + updateLink: async (linkId, data) => { + const endpoint = `${ENTRYPOINT}links/${linkId}`; + data.id = linkId; + + const response = await axios.put(endpoint, data) + return response.data + }, + getCategories: async () => { + const response = await axios.get(ENTRYPOINT + 'link_categories') + return response.data['hydra:member'] + }, +}