View | Details | Raw Unified | Return to bug 32939
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue (-2 / +9 lines)
Lines 122-128 Link Here
122
import { inject } from "vue"
122
import { inject } from "vue"
123
import Breadcrumb from "../../components/Breadcrumb.vue"
123
import Breadcrumb from "../../components/Breadcrumb.vue"
124
import Dialog from "../../components/Dialog.vue"
124
import Dialog from "../../components/Dialog.vue"
125
import { fetchVendors } from "../../fetch/erm.js"
125
import { APIClient } from "../../fetch/api-client.js"
126
import "vue-select/dist/vue-select.css"
126
import "vue-select/dist/vue-select.css"
127
127
128
export default {
128
export default {
Lines 154-160 export default { Link Here
154
        }
154
        }
155
    },
155
    },
156
    beforeCreate() {
156
    beforeCreate() {
157
        fetchVendors().then(vendors => (this.vendorStore.vendors = vendors))
157
        const client = APIClient.acquisition
158
        client.vendors.getAll().then(
159
            vendors => {
160
                this.vendors = vendors
161
                this.initialized = true
162
            },
163
            error => {}
164
        )
158
    },
165
    },
159
    components: {
166
    components: {
160
        Breadcrumb,
167
        Breadcrumb,
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js (+20 lines)
Line 0 Link Here
1
import HttpClient from "./http-client";
2
3
export class AcquisitionAPIClient extends HttpClient {
4
    constructor() {
5
        super({
6
            baseURL: "/api/v1/acquisitions/",
7
        });
8
    }
9
10
    get vendors() {
11
        return {
12
            getAll: (query) =>
13
                this.get({
14
                    endpoint: "vendors?" + (query || "_per_page=-1"),
15
                }),
16
        };
17
    }
18
}
19
20
export default AcquisitionAPIClient;
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/api-client.js (+2 lines)
Lines 1-7 Link Here
1
import ERMAPIClient from "./erm-api-client";
1
import ERMAPIClient from "./erm-api-client";
2
import PatronAPIClient from "./patron-api-client";
2
import PatronAPIClient from "./patron-api-client";
3
import AcquisitionAPIClient from "./acquisition-api-client";
3
4
4
export const APIClient = {
5
export const APIClient = {
5
    erm: new ERMAPIClient(),
6
    erm: new ERMAPIClient(),
6
    patron: new PatronAPIClient(),
7
    patron: new PatronAPIClient(),
8
    acquisition: new AcquisitionAPIClient(),
7
};
9
};
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm.js (-6 lines)
Lines 2-12 import { setError } from "../messages"; Link Here
2
2
3
//TODO: all of these functions should be deleted and reimplemented in the components using ERMAPIClient
3
//TODO: all of these functions should be deleted and reimplemented in the components using ERMAPIClient
4
4
5
export const fetchVendors = function () {
6
    const apiUrl = "/api/v1/acquisitions/vendors?_per_page=-1";
7
    return myFetch(apiUrl);
8
};
9
10
const _createEditPackage = function (method, erm_package) {
5
const _createEditPackage = function (method, erm_package) {
11
    let apiUrl = "/api/v1/erm/eholdings/local/packages";
6
    let apiUrl = "/api/v1/erm/eholdings/local/packages";
12
7
13
- 

Return to bug 32939