Page updated Jan 16, 2024

Delete data

DELETE data

import { del } from 'aws-amplify/api'; async function deleteTodo() { try { const restOperation = del({ apiName: 'todo-api', path: '/todo/1' }); await restOperation.response; console.log('DELETE call succeeded'); } catch (error) { console.log('DELETE call failed: ', error); } }
1import { del } from 'aws-amplify/api';
2
3async function deleteTodo() {
4 try {
5 const restOperation = del({
6 apiName: 'todo-api',
7 path: '/todo/1'
8 });
9 await restOperation.response;
10 console.log('DELETE call succeeded');
11 } catch (error) {
12 console.log('DELETE call failed: ', error);
13 }
14}