Skip to content

Commit 1448f30

Browse files
committed
implementing follow_response option for action component
analog to #283 #288
1 parent 7014479 commit 1448f30

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

app/concepts/matestack/ui/core/action/action.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,27 @@ const componentDef = {
2626
if (self.componentConfig["success"] != undefined && self.componentConfig["success"]["emit"] != undefined) {
2727
matestackEventHub.$emit(self.componentConfig["success"]["emit"], response.data);
2828
}
29-
if (self.componentConfig["success"] != undefined && self.componentConfig["success"]["transition"] != undefined && self.$store != undefined) {
29+
if (self.componentConfig["success"] != undefined
30+
&& self.componentConfig["success"]["transition"] != undefined
31+
&& (
32+
self.componentConfig["success"]["transition"]["follow_response"] == undefined
33+
||
34+
self.componentConfig["success"]["transition"]["follow_response"] === false
35+
)
36+
&& self.$store != undefined
37+
) {
3038
let path = self.componentConfig["success"]["transition"]["path"]
3139
self.$store.dispatch('navigateTo', {url: path, backwards: false})
40+
return;
41+
}
42+
if (self.componentConfig["success"] != undefined
43+
&& self.componentConfig["success"]["transition"] != undefined
44+
&& self.componentConfig["success"]["transition"]["follow_response"] === true
45+
&& self.$store != undefined
46+
) {
47+
let path = response.data["transition_to"];
48+
self.$store.dispatch('navigateTo', {url: path, backwards: false});
49+
return;
3250
}
3351
})
3452
.catch(function(error){

vendor/assets/javascripts/matestack-ui-core.js

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/assets/javascripts/matestack-ui-core.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)