-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): cant leave workspace (#6999)
- Loading branch information
Showing
4 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/frontend/core/src/modules/permissions/services/permission.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
import type { WorkspaceService, WorkspacesService } from '@toeverything/infra'; | ||
import { Service } from '@toeverything/infra'; | ||
|
||
import { WorkspacePermission } from '../entities/permission'; | ||
import type { WorkspacePermissionStore } from '../stores/permission'; | ||
|
||
export class WorkspacePermissionService extends Service { | ||
permission = this.framework.createEntity(WorkspacePermission); | ||
|
||
constructor( | ||
private readonly workspaceService: WorkspaceService, | ||
private readonly workspacesService: WorkspacesService, | ||
private readonly store: WorkspacePermissionStore | ||
) { | ||
super(); | ||
} | ||
|
||
async leaveWorkspace() { | ||
await this.store.leaveWorkspace( | ||
this.workspaceService.workspace.id, | ||
this.workspaceService.workspace.name$.value ?? '' | ||
); | ||
this.workspacesService.list.revalidate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters