primevue-mirror/service/CustomerService.js

37 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-12-09 13:41:56 +00:00
const baseUrl = process.env.NODE_ENV === 'production' ? '/primevue-nuxt/' : '/';
2020-07-02 15:17:07 +00:00
export default class CustomerService {
2021-10-05 07:41:07 +00:00
getCustomersSmall() {
2022-12-09 13:41:56 +00:00
return fetch(baseUrl + 'demo/data/customers-small.json')
2022-09-14 14:26:41 +00:00
.then((res) => res.json())
.then((d) => d.data);
2021-10-05 07:41:07 +00:00
}
getCustomersMedium() {
2022-12-09 13:41:56 +00:00
return fetch(baseUrl + 'demo/data/customers-medium.json')
2022-09-14 14:26:41 +00:00
.then((res) => res.json())
.then((d) => d.data);
2021-10-05 07:41:07 +00:00
}
2020-03-04 12:10:34 +00:00
2021-10-05 07:41:07 +00:00
getCustomersLarge() {
2022-12-09 13:41:56 +00:00
return fetch(baseUrl + 'demo/data/customers-large.json')
2022-09-14 14:26:41 +00:00
.then((res) => res.json())
.then((d) => d.data);
2021-10-05 07:41:07 +00:00
}
2020-03-04 12:10:34 +00:00
2021-10-05 07:41:07 +00:00
getCustomersXLarge() {
2022-12-09 13:41:56 +00:00
return fetch(baseUrl + 'demo/data/customers-xlarge.json')
2022-09-14 14:26:41 +00:00
.then((res) => res.json())
.then((d) => d.data);
2021-10-05 07:41:07 +00:00
}
2020-03-04 12:10:34 +00:00
2021-10-05 07:41:07 +00:00
getCustomers(params) {
2022-09-14 14:26:41 +00:00
const queryParams = params
? Object.keys(params)
.map((k) => encodeURIComponent(k) + '=' + encodeURIComponent(params[k]))
.join('&')
: '';
return fetch('https://www.primefaces.org/data/customers?' + queryParams).then((res) => res.json());
2021-10-05 07:41:07 +00:00
}
}