38 lines
1.1 KiB
JavaScript
Executable File
38 lines
1.1 KiB
JavaScript
Executable File
const baseUrl = process.env.NODE_ENV === 'production' ? '/primevue-nuxt/' : '/';
|
|
|
|
export default class CustomerService {
|
|
getCustomersSmall() {
|
|
return fetch(baseUrl + 'demo/data/customers-small.json')
|
|
.then((res) => res.json())
|
|
.then((d) => d.data);
|
|
}
|
|
|
|
getCustomersMedium() {
|
|
return fetch(baseUrl + 'demo/data/customers-medium.json')
|
|
.then((res) => res.json())
|
|
.then((d) => d.data);
|
|
}
|
|
|
|
getCustomersLarge() {
|
|
return fetch(baseUrl + 'demo/data/customers-large.json')
|
|
.then((res) => res.json())
|
|
.then((d) => d.data);
|
|
}
|
|
|
|
getCustomersXLarge() {
|
|
return fetch(baseUrl + 'demo/data/customers-xlarge.json')
|
|
.then((res) => res.json())
|
|
.then((d) => d.data);
|
|
}
|
|
|
|
getCustomers(params) {
|
|
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());
|
|
}
|
|
}
|