From 9abba3d8d30703e657e3d95e8ef4025ef586b868 Mon Sep 17 00:00:00 2001 From: Greg Billetdeaux Date: Thu, 5 Jan 2023 13:53:21 -0600 Subject: [PATCH 1/2] fix(angular-getting-started) fixed some type errors on Taking Photos and Loading Photos pages --- docs/angular/your-first-app/2-taking-photos.md | 2 +- docs/angular/your-first-app/4-loading-photos.md | 4 ++-- docs/angular/your-first-app/5-adding-mobile.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/angular/your-first-app/2-taking-photos.md b/docs/angular/your-first-app/2-taking-photos.md index 73b6d20533f..1a0cb3e2727 100644 --- a/docs/angular/your-first-app/2-taking-photos.md +++ b/docs/angular/your-first-app/2-taking-photos.md @@ -83,7 +83,7 @@ Outside of the `PhotoService` class definition (the very bottom of the file), cr ```tsx export interface UserPhoto { filepath: string; - webviewPath: string; + webviewPath?: string; } ``` diff --git a/docs/angular/your-first-app/4-loading-photos.md b/docs/angular/your-first-app/4-loading-photos.md index 1e6896557cf..1b3c7cf7ae8 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) : []); // 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 72ef3429132..7c00dbae600 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) : []); // Easiest way to detect when running on the web: // “when the platform is NOT hybrid, do this” From d0daa871c9362faf4c034d7df0956a4c645593dd Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Mon, 24 Apr 2023 13:57:21 -0700 Subject: [PATCH 2/2] fix(angular-getting-started): add data type --- docs/angular/your-first-app/4-loading-photos.md | 2 +- docs/angular/your-first-app/5-adding-mobile.md | 2 +- .../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, 4 insertions(+), 4 deletions(-) diff --git a/docs/angular/your-first-app/4-loading-photos.md b/docs/angular/your-first-app/4-loading-photos.md index 1b3c7cf7ae8..6f59d3f951f 100644 --- a/docs/angular/your-first-app/4-loading-photos.md +++ b/docs/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 { value } = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = (value ? JSON.parse(value) : []); + 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 2a63126682a..844b87d723d 100644 --- a/docs/angular/your-first-app/5-adding-mobile.md +++ b/docs/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 { value } = await Preferences.get({ key: this.PHOTO_STORAGE }); - this.photos = (value ? JSON.parse(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” 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”