fix: clear invalid API key and reset state on unlock failure

This commit is contained in:
ramvignesh-b
2026-05-12 03:41:08 +05:30
parent 72548db9af
commit 7192ba381d
+4 -1
View File
@@ -43,7 +43,10 @@ document.addEventListener("alpine:init", () => {
await this.fetchProviders();
this.isUnlocked = true;
} catch (err) {
this.showNotification(`Failed to unlock: ${err.message}`, "error");
this.showNotification(`Failed to unlock: ${err.message}. Check your API Key`, "error");
localStorage.removeItem("toknd_api_key");
this.isUnlocked = false;
this.apiKey = "";
} finally {
this.loading = false;
}