Skip to content

Commit

Permalink
fix bad login case
Browse files Browse the repository at this point in the history
  • Loading branch information
delanni committed May 25, 2024
1 parent 3f6ac37 commit de2bbe3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion amakit.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ class Amakit {

getCredentials = () => {
const credentials = JSON.parse(localStorage.getItem("awsCredentials") || "null");
return credentials;
if (!credentials || !credentials.accessKeyId || !credentials.secretAccessKey) {
return null;
} else {
return credentials;
}
}

saveCredentials = (name, accessKeyId, secretAccessKey) => {
Expand Down Expand Up @@ -74,6 +78,7 @@ class Amakit {
this.AWS.config.credentials.get((err) => {
if (err) {
console.error("Error: ", err);
localStorage.removeItem("awsCredentials");
reject(err);
} else {
this.isAuthenticated = true;
Expand Down

0 comments on commit de2bbe3

Please sign in to comment.