pinafore/routes/_components/settings/instance/InstanceActions.html
Nolan Lawson bc3a74bbcb don't wait if idb is blocked, remove workerize-loader (#602)
There are two issues here:

- if IDB is blocked, then the promise never resolves when you log out (and call indexedDB.deleteDatabase) and the app remains in a permanently hung state
- why is IDB blocked? well, something seems to have changed in Chrome 70 such that doing these operations in a web worker causes the blocked error. The benefits of workerizing IDB is so small that I'd rather just remove it at this point.
2018-11-04 13:59:14 -08:00

49 lines
1.4 KiB
HTML

<form class="instance-actions" aria-label="Switch to or log out of this instance">
{#if $loggedInInstancesInOrder.length > 1 && $currentInstance !== instanceName}
<button class="primary"
on:click="onSwitchToThisInstance(event)">
Switch to this instance
</button>
{/if}
<button on:click="onLogOut(event)">Log out</button>
</form>
<style>
.instance-actions {
width: 100%;
display: flex;
justify-content: right;
margin: 20px 0;
}
.instance-actions button {
margin: 0 5px;
flex-basis: 100%;
}
</style>
<script>
import { store } from '../../../_store/store'
import { importShowConfirmationDialog } from '../../../_components/dialog/asyncDialogs'
import { switchToInstance, logOutOfInstance } from '../../../_actions/instances'
export default {
store: () => store,
methods: {
onSwitchToThisInstance (e) {
e.preventDefault()
let { instanceName } = this.get()
switchToInstance(instanceName)
},
async onLogOut (e) {
e.preventDefault()
let { instanceName } = this.get()
let showConfirmationDialog = await importShowConfirmationDialog()
showConfirmationDialog({
text: `Log out of ${instanceName}?`,
onPositive () {
/* no await */ logOutOfInstance(instanceName)
}
})
}
}
}
</script>