Skip to content

Commit

Permalink
fix storage list code snippet (aws-amplify#6426)
Browse files Browse the repository at this point in the history
* fix storage list code snippet

* Update index.mdx

---------

Co-authored-by: Ashwin Kumar <[email protected]>
Co-authored-by: Katie Goines <[email protected]>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent d6a6926 commit 6a47df4
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/pages/[platform]/build-a-backend/storage/list/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,12 @@ To list current user's objects:
import { list } from 'aws-amplify/storage';

try {
const response = await list({ prefix: 'photos/', options: {
accessLevel: 'protected',
}});
const response = await list({
prefix: 'photos/',
options: {
accessLevel: 'protected',
}
});
console.log('Listed Items:', response.items);
} catch(error) {
console.log('Error ': error);
Expand All @@ -129,10 +132,13 @@ To list other user's objects:
import { list } from 'aws-amplify/storage';

try {
const response = list({ prefix: 'photos/', options: {
accessLevel: 'protected',
targetIdentityId: 'xxxxxxx' // the identityId of that user
}});
const response = await list({
prefix: 'photos/',
options: {
accessLevel: 'protected',
targetIdentityId: 'xxxxxxx' // the identityId of that user
}
});
console.log('Listed Items:', response.items);
} catch(error) {
console.log('Error ': error);
Expand All @@ -145,9 +151,12 @@ try {
import { list } from 'aws-amplify/storage';

try {
const response = list({ prefix: 'photos/', options: {
accessLevel: 'private',
}})
const response = await list({
prefix: 'photos/',
options: {
accessLevel: 'private',
}
});
console.log('Listed Items:', response.items);
} catch(error) {
console.log('Error ': error);
Expand Down

0 comments on commit 6a47df4

Please sign in to comment.