fix: validate token from storage

This commit is contained in:
Naomi Carrigan 2025-02-17 02:51:39 -08:00
parent b386ec53fb
commit 278deb6d47
Signed by: naomi
SSH Key Fingerprint: SHA256:rca1iUI2OhAM6n4FIUaFcZcicmri0jgocqKiTTAfrt8

View File

@ -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;
});
}
/**