2022-08-04 09:41:29 +00:00
|
|
|
/* global axios */
|
|
|
|
|
|
|
|
import PortalsAPI from './portals';
|
|
|
|
|
|
|
|
class CategoriesAPI extends PortalsAPI {
|
|
|
|
constructor() {
|
|
|
|
super('categories', { accountScoped: true });
|
|
|
|
}
|
|
|
|
|
2022-10-21 20:43:15 +00:00
|
|
|
get({ portalSlug, locale }) {
|
|
|
|
return axios.get(`${this.url}/${portalSlug}/categories?locale=${locale}`);
|
2022-08-04 09:41:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
create({ portalSlug, categoryObj }) {
|
|
|
|
return axios.post(`${this.url}/${portalSlug}/categories`, categoryObj);
|
|
|
|
}
|
|
|
|
|
2022-09-02 17:04:07 +00:00
|
|
|
update({ portalSlug, categoryId, categoryObj }) {
|
|
|
|
return axios.patch(
|
|
|
|
`${this.url}/${portalSlug}/categories/${categoryId}`,
|
|
|
|
categoryObj
|
|
|
|
);
|
2022-08-04 09:41:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
delete({ portalSlug, categoryId }) {
|
|
|
|
return axios.delete(`${this.url}/${portalSlug}/categories/${categoryId}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new CategoriesAPI();
|