File tree Expand file tree Collapse file tree 6 files changed +79
-31
lines changed
src/pages/[platform]/build-a-backend/add-aws-services/rest-api Expand file tree Collapse file tree 6 files changed +79
-31
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,10 @@ async function deleteItem() {
3737 try {
3838 const restOperation = del ({
3939 apiName: ' myRestApi' ,
40- path: ' items/1'
40+ path: ' items/1' ,
41+ retryStrategy: {
42+ strategy: ' no-retry'
43+ },
4144 });
4245 await restOperation .response ;
4346 console .log (' DELETE call succeeded' );
Original file line number Diff line number Diff line change @@ -36,9 +36,12 @@ import { get } from 'aws-amplify/api';
3636async function getItem() {
3737 try {
3838 const restOperation = get ({
39- apiName: ' myRestApi' ,
40- path: ' items'
41- });
39+ apiName: ' myRestApi' ,
40+ path: ' items'
41+ retryStrategy : {
42+ strategy: ' no-retry'
43+ },
44+ });
4245 const response = await restOperation .response ;
4346 console .log (' GET call succeeded: ' , response );
4447 } catch (error ) {
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ async function postItem() {
4242 body: {
4343 message: ' Mow the lawn'
4444 }
45- }
45+ },
46+ retryStrategy: {
47+ strategy: ' no-retry'
48+ },
4649 });
4750
4851 const { body } = await restOperation .response ;
Original file line number Diff line number Diff line change @@ -233,13 +233,22 @@ import outputs from '../amplify_outputs.json';
233233
234234const amplifyConfig = parseAmplifyConfig (outputs );
235235
236- Amplify .configure ({
237- ... amplifyConfig ,
238- API: {
239- ... amplifyConfig .API ,
240- REST: outputs .custom .API ,
236+ Amplify .configure (
237+ {
238+ ... amplifyConfig ,
239+ API: {
240+ ... amplifyConfig .API ,
241+ REST: outputs .custom .API ,
242+ },
241243 },
242- });
244+ {
245+ API: {
246+ retryStrategy: {
247+ strategy: ' no-retry'
248+ },
249+ },
250+ }
251+ );
243252```
244253</InlineFilter >
245254
@@ -251,13 +260,22 @@ import outputs from '@/amplify_outputs.json';
251260
252261const amplifyConfig = parseAmplifyConfig (outputs );
253262
254- Amplify .configure ({
255- ... amplifyConfig ,
256- API: {
257- ... amplifyConfig .API ,
258- REST: outputs .custom .API ,
263+ Amplify .configure (
264+ {
265+ ... amplifyConfig ,
266+ API: {
267+ ... amplifyConfig .API ,
268+ REST: outputs .custom .API ,
269+ },
259270 },
260- });
271+ {
272+ API: {
273+ retryStrategy: {
274+ strategy: ' no-retry'
275+ },
276+ }
277+ }
278+ );
261279```
262280</InlineFilter >
263281
Original file line number Diff line number Diff line change @@ -216,13 +216,22 @@ import outputs from '../amplify_outputs.json';
216216
217217const amplifyConfig = parseAmplifyConfig (outputs);
218218
219- Amplify .configure ({
220- ... amplifyConfig,
221- API : {
222- ... amplifyConfig .API ,
223- REST : outputs .custom .API ,
219+ Amplify .configure (
220+ {
221+ ... amplifyConfig,
222+ API : {
223+ ... amplifyConfig .API ,
224+ REST : outputs .custom .API ,
225+ },
224226 },
225- });
227+ {
228+ API : {
229+ retryStrategy: {
230+ strategy: ' no-retry'
231+ },
232+ }
233+ }
234+ );
226235```
227236</InlineFilter >
228237
@@ -234,13 +243,22 @@ import outputs from '@/amplify_outputs.json';
234243
235244const amplifyConfig = parseAmplifyConfig (outputs );
236245
237- Amplify .configure ({
238- ... amplifyConfig ,
239- API: {
240- ... amplifyConfig .API ,
241- REST: outputs .custom .API ,
242- },
243- });
246+ Amplify .configure (
247+ {
248+ ... amplifyConfig ,
249+ API: {
250+ ... amplifyConfig .API ,
251+ REST: outputs .custom .API ,
252+ },
253+ },
254+ {
255+ API: {
256+ retryStrategy: {
257+ strategy: ' no-retry'
258+ },
259+ }
260+ }
261+ );
244262```
245263</InlineFilter >
246264
Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ async function updateItems() {
4141 path: ' items/1' ,
4242 options: {
4343 body: Item
44- }
44+ },
45+ retryStrategy: {
46+ strategy: ' no-retry'
47+ },
4548 });
4649 const response = await restOperation .response ;
4750 console .log (' PUT call succeeded: ' , response );
You can’t perform that action at this time.
0 commit comments