Revert "Add generic 412 http response handler to ask for dashboard refresh"

This reverts commit 11a6cf8236.

It's unclear in what situations a 412 handler that refreshes the dashboard will help.

We use BoxError.INVALID_CREDENTIALS to be 412.

* Used as internal error code for failed password, app password and totp check
* When password is wrong in external ldap syncing
* appstore token is invalid

In all cases, a dashboard refresh will do nothing afaict. For good measure, I have
converted appstore token case into LICENSE_ERROR which is a 402.
This commit is contained in:
Girish Ramakrishnan
2025-09-11 12:37:30 +02:00
parent 14b51c0c74
commit 82c8fa2640
3 changed files with 8 additions and 37 deletions
+1 -30
View File
@@ -1,15 +1,10 @@
<script setup>
import { useI18n } from 'vue-i18n';
const i18n = useI18n();
const t = i18n.t;
import { onMounted, ref, useTemplateRef, provide } from 'vue';
import { Notification, fetcher, SideBar, InputDialog } from '@cloudron/pankow';
import { Notification, fetcher, SideBar } from '@cloudron/pankow';
import { setLanguage } from './i18n.js';
import { API_ORIGIN, TOKEN_TYPES } from './constants.js';
import { redirectIfNeeded } from './utils.js';
import AppstoreModel from './models/AppstoreModel.js';
import ProfileModel from './models/ProfileModel.js';
import ProvisionModel from './models/ProvisionModel.js';
import DashboardModel from './models/DashboardModel.js';
@@ -77,27 +72,6 @@ const VIEWS = {
VOLUMES: 'volumes',
};
const appstoreModel = AppstoreModel.create();
const inputDialog = useTemplateRef('inputDialog');
async function showDashboardRefreshRequired() {
// first trigger a subscription and feature refresh on the backend
await appstoreModel.getSubscription();
const yes = await inputDialog.value.confirm({
message: 'Something went wrong. Dashboard refresh required.',
confirmStyle: 'primary',
rejectStyle: 'secondary',
confirmLabel: 'Refresh',
rejectLabel: t('main.dialog.no')
});
if (!yes) return;
window.location.reload(true);
}
const offlineOverlay = useTemplateRef('offlineOverlay');
function onOnline() {
@@ -113,8 +87,6 @@ fetcher.globalOptions.errorHook = (error) => {
// re-login will make the code get a new token
if (error.status === 401) return profileModel.logout();
if (error.status === 412) return showDashboardRefreshRequired();
if (error.status === 500 || error.status === 501) {
// actual internal server error, most likely a bug or timeout log to console only to not alert the user
console.error(error);
@@ -294,7 +266,6 @@ onMounted(async () => {
<Notification />
<OfflineOverlay ref="offlineOverlay" @online="onOnline()" :href="'https://docs.cloudron.io/troubleshooting/'" :label="$t('main.offline')" />
<SubscriptionRequiredDialog ref="subscriptionRequiredDialog"/>
<InputDialog ref="inputDialog"/>
<div v-if="ready" style="display: flex; flex-direction: row; overflow: hidden; height: 100%;">
<SideBar v-if="profile.isAtLeastUserManager" ref="sidebar">