method destroy
Удаляет запись из источника данных
ПАРАМЕТРЫ:
keys
Первичный ключ, или массив первичных ключей записи
ТИП:CrudEntityKey | Array<CrudEntityKey>
meta
Дополнительные мета данные
ТИП:object
ВОЗВРАЩАЕТ:
Promise<void>
Асинхронный результат выполнения: в случае успеха ничего не вернет, в случае ошибки - Error.
Примеры
Удалим статью с ключом 'article-id-to-destroy':
const dataSource = new CrudSource({
endpoint: '/articles/',
keyProperty: 'code'
});
dataSource.destroy('article-id-to-destroy').then(() => {
console.log('The article has been deleted successfully');
}).catch((error) => {
console.error('Can\'t delete the article', error);
});
Удалим сотрудника с идентификатором 123321:
const dataSource = new SbisService({
endpoint: 'Employee',
keyProperty: '@Employee'
});
dataSource.destroy(123321).then(() => {
console.log('The employee has been deleted successfully');
}).catch((error) => {
console.error('Can\'t delete the article', error);
});