appstore: add unlink account route
This commit is contained in:
@@ -42,10 +42,10 @@ function create() {
|
||||
if (error || result.status !== 200) return [error || result];
|
||||
return [null, result.body];
|
||||
},
|
||||
async resetCloudronId() {
|
||||
async unlinkAccount() {
|
||||
let result;
|
||||
try {
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/appstore/reset_cloudron_id`, {}, { access_token: accessToken });
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/appstore/unlink_account`, {}, { access_token: accessToken });
|
||||
} catch (e) {
|
||||
return [e];
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ async function refresh() {
|
||||
}
|
||||
|
||||
const inputDialog = useTemplateRef('inputDialog');
|
||||
async function onAskResetCloudron() {
|
||||
async function onAskUnlinkAccount() {
|
||||
const yes = await inputDialog.value.confirm({
|
||||
title: t('settings.appstoreAccount.resetDialog.title'),
|
||||
message: t('settings.appstoreAccount.resetDialog.description'),
|
||||
title: t('settings.appstoreAccount.unlinkDialog.title'),
|
||||
message: t('settings.appstoreAccount.unlinkDialog.description'),
|
||||
confirmStyle: 'danger',
|
||||
confirmLabel: t('main.dialog.yes'),
|
||||
rejectLabel: t('main.dialog.cancel'),
|
||||
@@ -61,13 +61,13 @@ async function onAskResetCloudron() {
|
||||
|
||||
if (!yes) return;
|
||||
|
||||
await onResetCloudron();
|
||||
await onUnlinkAccount();
|
||||
}
|
||||
|
||||
async function onResetCloudron() {
|
||||
async function onUnlinkAccount() {
|
||||
busy.value = true;
|
||||
|
||||
const [error] = await appstoreModel.resetCloudronId();
|
||||
const [error] = await appstoreModel.unlinkAccount();
|
||||
if (error) return console.error(error);
|
||||
|
||||
await refresh();
|
||||
@@ -129,7 +129,7 @@ onUnmounted(() => {
|
||||
<span v-else>{{ $t('settings.appstoreAccount.subscriptionChangeAction') }}</span>
|
||||
</Button>
|
||||
|
||||
<Button secondary @click="onAskResetCloudron" v-if="email">{{ $t('settings.appstoreAccount.resetAction') }}</Button>
|
||||
<Button secondary @click="onAskUnlinkAccount" v-if="email">{{ $t('settings.appstoreAccount.unlinkAction') }}</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -147,7 +147,7 @@ onUnmounted(() => {
|
||||
Unknown Cloudron ID or invalid cloudron.io token.
|
||||
</div>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<Button @click="onResetCloudron">{{ $t('settings.appstoreAccount.resetAction') }}</Button>
|
||||
<Button @click="onUnlinkAccount">{{ $t('settings.appstoreAccount.unlinkAction') }}</Button>
|
||||
</div>
|
||||
</SettingsItem>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user