From d8b91fe24e3b71fae46556b3b01b6a37400f15ae Mon Sep 17 00:00:00 2001 From: gregbilletdeaux <121880999+gregbilletdeaux@users.noreply.github.com> Date: Mon, 24 Apr 2023 16:26:46 -0500 Subject: [PATCH] fix(angular-getting-started): type errors (#2688) Co-authored-by: Greg Billetdeaux Co-authored-by: Maria Hutt --- docs/angular/your-first-app/4-loading-photos.md | 4 ++-- docs/angular/your-first-app/5-adding-mobile.md | 4 ++-- .../version-v6/angular/your-first-app/4-loading-photos.md | 2 +- .../version-v6/angular/your-first-app/5-adding-mobile.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/angular/your-first-app/4-loading-photos.md b/docs/angular/your-first-app/4-loading-photos.md index 1e6896557cf..6f59d3f951f 100644 --- a/docs/angular/your-first-app/4-loading-photos.md +++ b/docs/angular/your-first-app/4-loading-photos.md @@ -35,8 +35,8 @@ With the photo array data saved, create a function called `loadSaved()` that can ```tsx public async loadSaved() { // Retrieve cached photo array data - const photoList = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = JSON.parse(photoList.value) || []; + const { value } = await Preferences.get({ key: this.PHOTO_STORAGE }); + this.photos = (value ? JSON.parse(value) : []) as UserPhoto[]; // more to come... } diff --git a/docs/angular/your-first-app/5-adding-mobile.md b/docs/angular/your-first-app/5-adding-mobile.md index 25e18e856c9..844b87d723d 100644 --- a/docs/angular/your-first-app/5-adding-mobile.md +++ b/docs/angular/your-first-app/5-adding-mobile.md @@ -93,8 +93,8 @@ Next, head back over to the `loadSaved()` function we implemented for the web ea ```tsx public async loadSaved() { // Retrieve cached photo array data - const photoList = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = JSON.parse(photoList.value) || []; + const { value } = await Preferences.get({ key: this.PHOTO_STORAGE }); + this.photos = (value ? JSON.parse(value) : []) as UserPhoto[]; // Easiest way to detect when running on the web: // “when the platform is NOT hybrid, do this” diff --git a/versioned_docs/version-v6/angular/your-first-app/4-loading-photos.md b/versioned_docs/version-v6/angular/your-first-app/4-loading-photos.md index 1e6896557cf..fdc2c4f3c8f 100644 --- a/versioned_docs/version-v6/angular/your-first-app/4-loading-photos.md +++ b/versioned_docs/version-v6/angular/your-first-app/4-loading-photos.md @@ -36,7 +36,7 @@ With the photo array data saved, create a function called `loadSaved()` that can public async loadSaved() { // Retrieve cached photo array data const photoList = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = JSON.parse(photoList.value) || []; + this.photos = (value ? JSON.parse(value) : []) as UserPhoto[]; // more to come... } diff --git a/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md b/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md index 25e18e856c9..481d4c16ca9 100644 --- a/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md +++ b/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md @@ -94,7 +94,7 @@ Next, head back over to the `loadSaved()` function we implemented for the web ea public async loadSaved() { // Retrieve cached photo array data const photoList = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = JSON.parse(photoList.value) || []; + this.photos = (value ? JSON.parse(value) : []) as UserPhoto[]; // Easiest way to detect when running on the web: // “when the platform is NOT hybrid, do this”