Skip to content

Commit

Permalink
Forward to path directly
Browse files Browse the repository at this point in the history
  • Loading branch information
udgover committed Jan 25, 2024
1 parent 7378383 commit 667a154
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions src/components/NewObject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export default {
entity: "entities",
observable: "observables/extended",
indicator: "indicators"
},
typeToSavedObjectPath: {
entity: "entities",
observable: "observables",
indicator: "indicators"
}
};
},
Expand All @@ -75,23 +80,7 @@ export default {
})
.then(response => {
this.$eventBus.emit("displayMessage", { message: `New ${this.objectType} created`, status: "success" });
let _name = "";
if (response.data.root_type == "entity")
{
_name = "EntityDetails";
}
else if (response.data.root_type == "indicator")
{
_name = "IndicatorDetails";
}
else if (response.data.root_type == "observable")
{
_name = "ObservableDetails";
}
this.$router.push({
name: _name,
params: { id: response.data.id, type: response.data.type }
});
this.$router.push({ path: `/${this.typeToSavedObjectPath[this.newObject.root_type]}/${response.data.id}` });
})
.catch(error => {
console.log(error);
Expand Down Expand Up @@ -134,7 +123,6 @@ export default {
{
return "unknown";
}
// return ENTITY_TYPES.find(t => t.type === this.objectType) ? "entity" : "indicator";
}
}
};
Expand Down

0 comments on commit 667a154

Please sign in to comment.