Merge pull request #6117 from keithjgrant/6095-redirect-after-host-delete

Fix redirect after host delete

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-02-28 00:45:05 +00:00
committed by GitHub

View File

@@ -44,7 +44,10 @@ function HostDetail({ host, i18n, onUpdateHost }) {
try {
await HostsAPI.destroy(id);
setIsloading(false);
history.push(`/inventories/inventory/${inventoryId}/hosts`);
const url = pathname.startsWith('/inventories')
? `/inventories/inventory/${inventoryId}/hosts/`
: `/hosts`;
history.push(url);
} catch (err) {
setDeletionError(err);
}