diff --git a/apps/agent/src/login-form/hooks/UseViewModel.ts b/apps/agent/src/login-form/hooks/UseViewModel.ts index 66ee97d..1d7a5c6 100644 --- a/apps/agent/src/login-form/hooks/UseViewModel.ts +++ b/apps/agent/src/login-form/hooks/UseViewModel.ts @@ -225,9 +225,9 @@ export const useViewModel = (): LoginFormViewModelInterface => { }, [agentApi, navigateTo] ), - handleReturnToAssistedMigration: useCallback(() => { - const assistedMigrationUrl = import.meta.env.ASSISTED_MIGRATION_URL || 'http://localhost:3000/migrate/wizard'; - window.open(assistedMigrationUrl, '_blank', 'noopener,noreferrer'); + handleReturnToAssistedMigration: useCallback(async () => { + const serviceUrl = await agentApi.getServiceUiUrl() || "http://localhost:3000/migrate/wizard"; + window.open(serviceUrl, '_blank', 'noopener,noreferrer'); }, []), handleChangeDataSharingAllowed: useCallback((checked)=>{ console.log(checked); diff --git a/packages/agent-client/src/apis/AgentApi.ts b/packages/agent-client/src/apis/AgentApi.ts index b42282f..94cf043 100644 --- a/packages/agent-client/src/apis/AgentApi.ts +++ b/packages/agent-client/src/apis/AgentApi.ts @@ -16,6 +16,7 @@ export interface AgentApiInterface { ): Promise>; getStatus(options?: RequestInit): Promise; getAgentVersion():Promise; + getServiceUiUrl():Promise; } export class AgentApi implements AgentApiInterface { @@ -70,4 +71,13 @@ export class AgentApi implements AgentApiInterface { const statusReply = (await response.json()) as { version: string }; return statusReply.version; } + async getServiceUiUrl(): Promise { + const request = new Request(this.configuration.basePath + "/url", { + method: "GET" + }); + + const response = await fetch(request); + const uiReply = (await response.json()) as { url: string }; + return uiReply.url; + } }