sb-mig
Version:
CLI to rule the world. (and handle stuff related to Storyblok CMS)
29 lines (28 loc) • 748 B
JavaScript
export const getSpace = (args, config) => {
const { sbApi } = config;
const { spaceId } = args;
return sbApi
.get(`spaces/${spaceId}`)
.then((res) => res.data)
.catch((err) => console.error(err));
};
export const getAllSpaces = (config) => {
const { sbApi } = config;
return sbApi
.get(`spaces/`)
.then((res) => res.data.spaces)
.catch((err) => {
console.error(err);
return [];
});
};
export const updateSpace = (args, config) => {
const { sbApi } = config;
const { spaceId, params } = args;
return sbApi
.put(`spaces/${spaceId}`, {
...params,
})
.then((res) => res.data)
.catch((err) => console.error(err));
};