Skip to content

Commit

Permalink
upgrade license if the vault is unarchived
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Apr 19, 2024
1 parent 9396a0e commit 8e5db22
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions frontend/src/components/VaultDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
<DownloadVaultTemplateDialog v-if="downloadingVaultTemplate && vault && vaultKeys" ref="downloadVaultTemplateDialog" :vault="vault" :vault-keys="vaultKeys" @close="downloadingVaultTemplate = false" />
<DisplayRecoveryKeyDialog v-if="displayingRecoveryKey && vault && vaultKeys" ref="displayRecoveryKeyDialog" :vault="vault" :vault-keys="vaultKeys" @close="displayingRecoveryKey = false" />
<ArchiveVaultDialog v-if="archivingVault && vault" ref="archiveVaultDialog" :vault="vault" @close="archivingVault = false" @archived="v => refreshVault(v)" />
<ReactivateVaultDialog v-if="reactivatingVault && vault" ref="reactivateVaultDialog" :vault="vault" @close="reactivatingVault = false" @reactivated="v => refreshVault(v)" />
<ReactivateVaultDialog v-if="reactivatingVault && vault" ref="reactivateVaultDialog" :vault="vault" @close="reactivatingVault = false" @reactivated="v => { refreshVault(v); refreshLicense();}" />
<RecoverVaultDialog v-if="recoveringVault && vault && me" ref="recoverVaultDialog" :vault="vault" :me="me" @close="recoveringVault = false" @recovered="reloadView()" />
</template>

Expand Down Expand Up @@ -294,8 +294,7 @@ async function fetchOwnerData() {
vaultRecoveryRequired.value = true;
} else if (error instanceof PaymentRequiredError) {
//refetch license
license.value = await backend.license.getUserInfo();
emit('licenseStatusUpdated', license.value);
await refreshLicense();
} else {
console.error('Retrieving ownership failed.', error);
onFetchError.value = error instanceof Error ? error : new Error('Unknown Error');
Expand Down Expand Up @@ -444,6 +443,11 @@ function permissionGranted() {
usersRequiringAccessGrant.value = [];
}
async function refreshLicense() {
license.value = await backend.license.getUserInfo();
emit('licenseStatusUpdated', license.value);
}
function refreshVault(updatedVault: VaultDto) {
vault.value = updatedVault;
emit('vaultUpdated', updatedVault);
Expand Down Expand Up @@ -489,8 +493,7 @@ async function removeMember(memberId: string) {
if (!licenseViolated.value) {
usersRequiringAccessGrant.value = await backend.vaults.getUsersRequiringAccessGrant(props.vaultId);
} else {
license.value = await backend.license.getUserInfo();
emit('licenseStatusUpdated', license.value);
await refreshLicense();
}
} catch (error) {
console.error('Removing member access failed.', error);
Expand Down

0 comments on commit 8e5db22

Please sign in to comment.