refactor: Switch cloud plan retrieval endpoint (no-changelog) (#6529)

* refactor: Switch cloud plan retrieval endpoint

* refactor: Remove user ID from request

* refactor: Update endpoint

* refactor: Update to /rest/admin/cloud-plan

* refactor: Remove redundant `/rest` segment
This commit is contained in:
Iván Ovejero 2023-07-05 12:57:50 +02:00 committed by GitHub
parent 7ffe3cb36a
commit 76aca62dd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View file

@ -1,11 +1,8 @@
import type { Cloud, IRestApiContext, InstanceUsage } from '@/Interface';
import { get } from '@/utils';
export async function getCurrentPlan(
context: IRestApiContext,
cloudUserId: string,
): Promise<Cloud.PlanData> {
return get(context.baseUrl, `/user/${cloudUserId}/plan`);
export async function getCurrentPlan(context: IRestApiContext): Promise<Cloud.PlanData> {
return get(context.baseUrl, '/admin/cloud-plan');
}
export async function getCurrentUsage(context: IRestApiContext): Promise<InstanceUsage> {

View file

@ -53,7 +53,7 @@ export const useCloudPlanStore = defineStore('cloudPlan', () => {
state.loadingPlan = true;
let plan;
try {
plan = await getCurrentPlan(rootStore.getRestCloudApiContext, `${cloudUserId}`);
plan = await getCurrentPlan(rootStore.getRestApiContext);
state.data = plan;
state.loadingPlan = false;
} catch (error) {