feat(editor): Support autologin for upgrade path (#7316)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Ricardo Espinoza
2023-10-06 13:16:27 +02:00
committed by GitHub
parent ab647b231d
commit 1dfa052301
26 changed files with 101 additions and 54 deletions

View File

@@ -5,7 +5,7 @@ import { useRootStore } from '@/stores/n8nRoot.store';
import { useSettingsStore } from '@/stores/settings.store';
import { useUIStore } from '@/stores/ui.store';
import { useUsersStore } from '@/stores/users.store';
import { getCurrentPlan, getCurrentUsage } from '@/api/cloudPlans';
import { getAdminPanelLoginCode, getCurrentPlan, getCurrentUsage } from '@/api/cloudPlans';
import { DateTime } from 'luxon';
import { CLOUD_TRIAL_CHECK_INTERVAL, STORES } from '@/constants';
@@ -71,6 +71,10 @@ export const useCloudPlanStore = defineStore(STORES.CLOUD_PLAN, () => {
}
};
const getAutoLoginCode = async (): Promise<{ code: string }> => {
return getAdminPanelLoginCode(rootStore.getRestApiContext);
};
const getOwnerCurrentPlan = async () => {
if (!hasCloudPlan.value) throw new Error('User does not have a cloud plan');
state.loadingPlan = true;
@@ -161,5 +165,6 @@ export const useCloudPlanStore = defineStore(STORES.CLOUD_PLAN, () => {
reset,
checkForCloudPlanData,
fetchUserCloudAccount,
getAutoLoginCode,
};
});