Skip to content

Commit

Permalink
Remove some warnings in test app
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierstoval committed Oct 28, 2023
1 parent d8ef1bc commit 86171bc
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/testApp/BookCrud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const bookCrud = new CrudDefinition('books', {
new Delete(fields, new UrlAction('List', '/admin/books/list'))
],

stateProcessor: new CallbackStateProcessor(async function (
stateProcessor: new CallbackStateProcessor(function (
data,
operation,
requestParameters = {}
Expand All @@ -65,7 +65,7 @@ export const bookCrud = new CrudDefinition('books', {
`Book ${requestParameters.id} was requested for deletion, but it's only a demo app, so as everything is in memory, you will still see it, please forgive us :)`
);

return;
return Promise.resolve();
}

if (operation.name === 'edit' || operation.name === 'new') {
Expand All @@ -77,13 +77,15 @@ export const bookCrud = new CrudDefinition('books', {
'\nYou should push this to a database via an API for example ;)'
);

return;
return Promise.resolve();
}

console.warn('Unsupported Books Crud action "' + operation.name + '".');
console.warn('StateProcessor error: Unsupported Books Crud action "' + operation.name + '".');

return Promise.resolve();
}),

stateProvider: new CallbackStateProvider(async function (
stateProvider: new CallbackStateProvider(function (
operation,
requestParameters: KeyValueObject = {}
) {
Expand All @@ -100,6 +102,10 @@ export const bookCrud = new CrudDefinition('books', {
return Promise.resolve(ret[0] || null);
}

console.warn('Unsupported Books Crud action "' + operation.name + '".');
if (operation.name !== 'edit' && operation.name !== 'view' && operation.name !== 'delete') {
console.warn('StateProvider error: Unsupported Books Crud action "' + operation.name + '".');
}

return Promise.resolve();
})
});

0 comments on commit 86171bc

Please sign in to comment.