File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -253,13 +253,11 @@ export class OsmApiClient extends BaseHttpClient implements ICancelableClient {
253253 }
254254
255255 async getWorkspaceBbox ( workspaceId : WorkspaceId ) {
256- const response = await this . _get ( `workspaces/${ workspaceId } /bbox.json` ) ;
257-
258- if ( response . status === 204 ) {
259- return undefined
260- }
261-
262- return await response . json ( ) ;
256+ // The workspace bbox lives on the v1 tasking API, owned by WorkspacesClient.
257+ // OsmApiClient is constructed before workspacesClient (which depends on it),
258+ // so we resolve the singleton lazily at call time to avoid the import cycle.
259+ const { workspacesClient } = await import ( '~/services/index' ) ;
260+ return workspacesClient . getWorkspaceBbox ( workspaceId ) ;
263261 }
264262
265263 async getExportBbox ( id : number ) {
Original file line number Diff line number Diff line change @@ -119,8 +119,22 @@ export class WorkspacesClient extends BaseHttpClient implements ICancelableClien
119119 }
120120 }
121121
122- getWorkspaceBbox ( id : WorkspaceId ) : Promise < BoundingBox > {
123- return this . #osmClient. getWorkspaceBbox ( id ) ;
122+ async getWorkspaceBbox ( id : WorkspaceId ) : Promise < BoundingBox | undefined > {
123+ const originalBaseUrl = this . _baseUrl ;
124+ this . _baseUrl = this . #newApiUrl;
125+
126+ try {
127+ const response = await this . _send ( `workspaces/${ id } /bbox` , 'GET' ) ;
128+
129+ if ( response . status === 204 ) {
130+ return undefined ;
131+ }
132+
133+ return await response . json ( ) ;
134+ }
135+ finally {
136+ this . _baseUrl = originalBaseUrl ;
137+ }
124138 }
125139
126140 async createWorkspace ( workspace : WorkspaceCreation ) : Promise < WorkspaceId > {
You can’t perform that action at this time.
0 commit comments