primevue-mirror/apps/showcase/service/IconService.js

19 lines
424 B
JavaScript
Raw Permalink Normal View History

2023-02-28 08:29:30 +00:00
let icons = [];
let selectedIcon = null;
export const IconService = {
getIcons() {
return fetch('/demo/data/icons.json', { headers: { 'Cache-Control': 'no-cache' } })
.then((res) => res.json())
.then((d) => d.icons);
},
getIcon(id) {
if (icons) {
selectedIcon = icons.find((x) => x.properties.id === id);
return selectedIcon;
}
}
};