feat(api): add listing workspaces
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { WorkspaceApiServiceInterface } from '@standardnotes/api'
|
||||
import { Uuid, WorkspaceType } from '@standardnotes/common'
|
||||
import { Workspace } from '@standardnotes/models'
|
||||
|
||||
import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface'
|
||||
import { AbstractService } from '../Service/AbstractService'
|
||||
@@ -13,6 +14,20 @@ export class WorkspaceManager extends AbstractService implements WorkspaceClient
|
||||
super(internalEventBus)
|
||||
}
|
||||
|
||||
async listWorkspaces(): Promise<{ ownedWorkspaces: Workspace[]; joinedWorkspaces: Workspace[] }> {
|
||||
try {
|
||||
const result = await this.workspaceApiService.listWorkspaces()
|
||||
|
||||
if (result.data.error !== undefined) {
|
||||
return { ownedWorkspaces: [], joinedWorkspaces: [] }
|
||||
}
|
||||
|
||||
return result.data
|
||||
} catch (error) {
|
||||
return { ownedWorkspaces: [], joinedWorkspaces: [] }
|
||||
}
|
||||
}
|
||||
|
||||
async acceptInvite(dto: {
|
||||
inviteUuid: string
|
||||
userUuid: string
|
||||
|
||||
Reference in New Issue
Block a user