From a2bba790fa92275669d386a17fa6fca28276f5e6 Mon Sep 17 00:00:00 2001 From: James Jarvis Date: Fri, 3 Jan 2025 11:40:02 -0800 Subject: [PATCH 1/3] add options --- .../[platform]/build-a-backend/storage/list-files/index.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx b/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx index 13c3370a014..ec4360d1359 100644 --- a/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx +++ b/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx @@ -73,8 +73,10 @@ const loadNextPage = async () => { let response = await list({ path: 'photos/', // Alternatively, path: ({ identityId }) => `album/{identityId}/photos/` - pageSize: PAGE_SIZE, - nextToken: nextToken + options: { + pageSize: PAGE_SIZE, + nextToken: nextToken + } } }); if (response.nextToken) { From 52c20840b7ecac309cfe420949100c186f5e0d61 Mon Sep 17 00:00:00 2001 From: James Jarvis Date: Fri, 3 Jan 2025 15:29:31 -0800 Subject: [PATCH 2/3] fix spacing --- .../storage/list-files/index.mdx | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx b/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx index ec4360d1359..1df34ee2a12 100644 --- a/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx +++ b/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx @@ -67,24 +67,23 @@ If the `pageSize` is set lower than the total file size, a single `list` call on import { list } from 'aws-amplify/storage'; const PAGE_SIZE = 20; -let nextToken = undefined; -//... +let nextToken; +// ... const loadNextPage = async () => { - let response = await list({ - path: 'photos/', - // Alternatively, path: ({ identityId }) => `album/{identityId}/photos/` - options: { - pageSize: PAGE_SIZE, - nextToken: nextToken - } - } - }); - if (response.nextToken) { - nextToken = response.nextToken; - } else { - nextToken = undefined; - } - // render list items from response.items + const response = await list({ + path: 'photos/', + // Alternatively, path: ({ identityId }) => `album/{identityId}/photos/` + options: { + pageSize: PAGE_SIZE, + nextToken, + }, + }); + if (response.nextToken) { + nextToken = response.nextToken; + } else { + nextToken = undefined; + } + // render list items from response.items }; ``` From cbcd7eb31da67a55186e1a67667be46f6135e2f1 Mon Sep 17 00:00:00 2001 From: James Jarvis Date: Fri, 3 Jan 2025 15:40:14 -0800 Subject: [PATCH 3/3] spaces instead of tabs --- .../storage/list-files/index.mdx | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx b/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx index 1df34ee2a12..188f37cc3ee 100644 --- a/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx +++ b/src/pages/[platform]/build-a-backend/storage/list-files/index.mdx @@ -70,20 +70,20 @@ const PAGE_SIZE = 20; let nextToken; // ... const loadNextPage = async () => { - const response = await list({ - path: 'photos/', - // Alternatively, path: ({ identityId }) => `album/{identityId}/photos/` - options: { - pageSize: PAGE_SIZE, - nextToken, - }, - }); - if (response.nextToken) { - nextToken = response.nextToken; - } else { - nextToken = undefined; - } - // render list items from response.items + const response = await list({ + path: 'photos/', + // Alternatively, path: ({ identityId }) => `album/{identityId}/photos/` + options: { + pageSize: PAGE_SIZE, + nextToken, + }, + }); + if (response.nextToken) { + nextToken = response.nextToken; + } else { + nextToken = undefined; + } + // render list items from response.items }; ```