From 278deb6d479a94f6e6b7a234e526f5f4db9ff188 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Mon, 17 Feb 2025 02:51:39 -0800 Subject: [PATCH] fix: validate token from storage --- client/src/app/review/review.component.ts | 33 ++++++++++------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/client/src/app/review/review.component.ts b/client/src/app/review/review.component.ts index 41254b3..0abdf7c 100644 --- a/client/src/app/review/review.component.ts +++ b/client/src/app/review/review.component.ts @@ -45,25 +45,20 @@ export class ReviewComponent { if (!storedToken) { return; } - this.token.setValue(storedToken); - this.valid = true; - - /* - * This.apiService - * .validateToken(storedToken) - * .then((valid) => { - * if (valid) { - * this.valid = true; - * } else { - * this.error = 'The token found in local storage is invalid.'; - * this.valid = false; - * } - * }) - * .catch(() => { - * this.error = 'An error occurred while validating your stored token.'; - * this.valid = false; - * }); - */ + this.apiService.validateToken(storedToken) + .then((valid) => { + if (valid) { + this.valid = true; + this.token.setValue(storedToken); + } else { + this.error = 'The token found in local storage is invalid.'; + this.valid = false; + } + }) + .catch(() => { + this.error = 'An error occurred while validating the token found in local storage.'; + this.valid = false; + }); } /**