salix/front/core/mocks/crud-model.js

60 lines
1.2 KiB
JavaScript

const crudModel = {
_data: [1, 2, 3],
data: [],
filter: {},
order: {},
insert: () => {
return {
then: callback => {
callback({data: {id: 1234}});
}
};
},
remove: () => {
return {
then: callback => {
callback({data: {id: 1234}});
}
};
},
save: () => {
return {
then: callback => {
callback({data: {id: 1234}});
}
};
},
on: () => {
return {
then: callback => {
callback({data: {id: 1234}});
}
};
},
refresh: () => {
return {
then: callback => {
return callback({data: {id: 1234}});
}
};
},
addFilter: () => {
return {
then: callback => {
return callback({data: {id: 1234}});
}
};
},
applyFilter: () => {
crudModel.data = crudModel._data;
return {
then: callback => {
return callback({data: {id: 1234}});
}
};
},
};
module.exports = crudModel;