oak-pay-business/es/components/wpProduct/config/index.js

57 lines
1.2 KiB
JavaScript

export default OakComponent({
entity: 'wpProduct',
isList: true,
projection: {
id: 1,
type: 1,
wpAccountId: 1,
applicationId: 1,
enabled: 1,
shipping: 1,
application: {
id: 1,
type: 1,
name: 1,
config: 1,
},
},
filters: [
{
filter() {
const { wpAccountId } = this.props;
return {
wpAccountId,
};
}
}
],
properties: {
systemId: '',
wpAccountId: '',
},
formData({ data, legalActions }) {
return {
wpProducts: data,
canCreate: legalActions?.includes('create'),
oakExecutable: this.tryExecute(),
};
},
actions: ['create', 'update', 'remove'],
lifetimes: {
ready() {
const { systemId } = this.props;
this.features.cache.refresh('application', {
data: {
id: 1,
name: 1,
type: 1,
config: 1,
},
filter: {
systemId,
},
});
}
}
});