Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
iTrooz committed Nov 16, 2023
1 parent 1141f5d commit 52d7575
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions extension/src/sites/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,28 +367,27 @@ async function createSiteList () {

const removeElement = siteElement.querySelector('#sites-list-template-remove')
removeElement.addEventListener('click', () => {

const lastSiteInProfile = profiles[site.profile].sites.length <= 1;
const lastSiteInProfile = profiles[site.profile].sites.length <= 1

document.getElementById('site-remove-button').onclick = async function () {
this.disabled = true
this.innerText = 'Removing...'
let deleteProfileCheckbox = document.getElementById("site-remove-last-checkbox");

const deleteProfileCheckbox = document.getElementById('site-remove-last-checkbox')
if (lastSiteInProfile && deleteProfileCheckbox.checked) {
const response = await browser.runtime.sendNativeMessage('firefoxpwa', {
cmd: 'RemoveProfile',
params: { id: site.profile }
})

if (response.type === 'Error') throw new Error(response.data)
if (response.type !== 'ProfileRemoved') throw new Error(`Received invalid response type: ${response.type}`)
} else {
const response = await browser.runtime.sendNativeMessage('firefoxpwa', {
cmd: 'UninstallSite',
params: { id: site.ulid }
})

if (response.type === 'Error') throw new Error(response.data)
if (response.type !== 'SiteUninstalled') throw new Error(`Received invalid response type: ${response.type}`)
}
Expand All @@ -403,11 +402,11 @@ async function createSiteList () {
}

if (lastSiteInProfile) {
document.getElementById('site-remove-last').hidden = false;
document.getElementById('site-remove-not-last').hidden = true;
document.getElementById('site-remove-last').hidden = false
document.getElementById('site-remove-not-last').hidden = true
} else {
document.getElementById('site-remove-last').hidden = true;
document.getElementById('site-remove-not-last').hidden = false;
document.getElementById('site-remove-last').hidden = true
document.getElementById('site-remove-not-last').hidden = false
}

Modal.getOrCreateInstance(document.getElementById('site-remove-modal')).show()
Expand Down

0 comments on commit 52d7575

Please sign in to comment.