feat: Enhance API client integration across web and CLI
- Added typedRequestInterfaces import to plugins.ts for better type handling. - Updated CLI client to utilize environment variables for Cloudly API credentials and improved authentication flow. - Refactored appstate.ts to use a shared API client instance, reducing redundancy in API calls for various actions. - Simplified external registry actions in appstate.ts by leveraging the shared API client. - Updated CloudlyDashboard and CloudlyViewSettings components to utilize the shared API client for fetching settings and managing connections. - Removed redundant TypedRequest instances in favor of direct API client calls for improved performance and maintainability. - Exposed the API client in plugins.ts for easier access in UI components.
This commit is contained in:
@@ -217,6 +217,13 @@ export class CloudlyDashboard extends DeesElement {
|
||||
console.log(loginState);
|
||||
if (loginState.identity) {
|
||||
this.identity = loginState.identity;
|
||||
try {
|
||||
appstate.apiClient.identity = loginState.identity;
|
||||
if (!appstate.apiClient['typedsocketClient']) {
|
||||
await appstate.apiClient.start();
|
||||
}
|
||||
try { appstate.apiClient.typedsocketClient.addTag('identity', appstate.apiClient.identity); } catch {}
|
||||
} catch (e) { console.warn('Failed to initialize API client WS', e); }
|
||||
await simpleLogin.switchToSlottedContent();
|
||||
await appstate.dataState.dispatchAction(appstate.getAllDataAction, null);
|
||||
}
|
||||
|
Reference in New Issue
Block a user