simplify check
This commit is contained in:
@@ -114,14 +114,10 @@ export class UmbDataTypeWorkspaceContext
|
||||
}
|
||||
|
||||
protected override _checkWillNavigateAway(newUrl: string): boolean {
|
||||
super._checkWillNavigateAway(newUrl);
|
||||
|
||||
const workspacePathBase = UMB_WORKSPACE_PATH_PATTERN.generateLocal({ entityType: this.getEntityType() });
|
||||
|
||||
if (this.getIsNew()) {
|
||||
return !newUrl.includes(`${workspacePathBase}/create`);
|
||||
return !newUrl.includes(`/create`) || super._checkWillNavigateAway(newUrl);
|
||||
} else {
|
||||
return !newUrl.includes(`${workspacePathBase}/edit/${this.getUnique()}`);
|
||||
return !newUrl.includes(`/edit/${this.getUnique()}`) || super._checkWillNavigateAway(newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,14 +56,10 @@ export class UmbLanguageWorkspaceContext
|
||||
}
|
||||
|
||||
protected override _checkWillNavigateAway(newUrl: string): boolean {
|
||||
super._checkWillNavigateAway(newUrl);
|
||||
|
||||
const workspacePathBase = UMB_WORKSPACE_PATH_PATTERN.generateLocal({ entityType: this.getEntityType() });
|
||||
|
||||
if (this.getIsNew()) {
|
||||
return !newUrl.includes(`${workspacePathBase}/create`);
|
||||
return !newUrl.includes(`/create`) || super._checkWillNavigateAway(newUrl);
|
||||
} else {
|
||||
return !newUrl.includes(`${workspacePathBase}/edit/${this.getUnique()}`);
|
||||
return !newUrl.includes(`/edit/${this.getUnique()}`) || super._checkWillNavigateAway(newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,14 +56,10 @@ export class UmbUserWorkspaceContext
|
||||
}
|
||||
|
||||
protected override _checkWillNavigateAway(newUrl: string): boolean {
|
||||
super._checkWillNavigateAway(newUrl);
|
||||
|
||||
const workspacePathBase = UMB_WORKSPACE_PATH_PATTERN.generateLocal({ entityType: this.getEntityType() });
|
||||
|
||||
if (this.getIsNew()) {
|
||||
return !newUrl.includes(`${workspacePathBase}/create`);
|
||||
return !newUrl.includes(`/create`) || super._checkWillNavigateAway(newUrl);
|
||||
} else {
|
||||
return !newUrl.includes(`${workspacePathBase}/edit/${this.getUnique()}`);
|
||||
return !newUrl.includes(`/edit/${this.getUnique()}`) || super._checkWillNavigateAway(newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user