saving data works, refreshes the UI, and also added an option to clear the storage from the UI
This commit is contained in:
@@ -9,6 +9,7 @@ Alpine.data('popup', () => ({
|
||||
profileNames: ['Default'],
|
||||
profileIndex: 0,
|
||||
visibleKey: false,
|
||||
confirmClear: false,
|
||||
|
||||
async init() {
|
||||
console.log("Initializing backend.");
|
||||
@@ -74,6 +75,19 @@ Alpine.data('popup', () => ({
|
||||
this.profileIndex = newIndex;
|
||||
},
|
||||
|
||||
async saveProfile() {
|
||||
let {name, privKey, hosts} = this;
|
||||
let profile = {name, privKey, hosts};
|
||||
await browser.runtime.sendMessage({kind: 'saveProfile', payload: profile});
|
||||
await this.refreshProfile();
|
||||
},
|
||||
|
||||
async clearData() {
|
||||
await browser.runtime.sendMessage({kind: 'clearData'});
|
||||
await this.init(); // Re-initialize after clearing
|
||||
this.confirmClear = false;
|
||||
},
|
||||
|
||||
// Properties
|
||||
|
||||
get hasValidPubKey() {
|
||||
|
||||
Reference in New Issue
Block a user