Skip to content

Commit

Permalink
fix: delete env
Browse files Browse the repository at this point in the history
  • Loading branch information
kungfuboy committed Jul 28, 2022
1 parent f3ba7a8 commit 2ca5630
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/workbench/browser/src/app/pages/api/api.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ export class ApiComponent implements OnInit, OnDestroy {
this.activeBar = data;
}
});
this.messageService.get().subscribe(({ type, data }) => {
if (type === 'deleteEnv') {
const list = this.envList.filter((it) => it.uuid !== Number(data));
this.envList = list;
if (this.envUuid === Number(data)) {
this.envUuid = null;
}
}
});
}
ngOnDestroy() {
this.destroy$.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export class EnvComponent implements OnInit, OnDestroy {

handleDeleteEnv($event, uuid: string) {
$event?.stopPropagation();
// * delete localstrage
this.messageService.send({ type: 'deleteEnv', data: uuid });
// * delete env in menu on left sidebar
this.storage.run('environmentRemove', [uuid], async (result: StorageRes) => {
if (result.status === StorageResStatus.success) {
Expand Down

0 comments on commit 2ca5630

Please sign in to comment.