@fishawack/lab-velocity 2.0.0-beta.55 → 2.0.0-beta.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,13 +62,26 @@ export default {
62
62
 
63
63
  this.emitter?.emit("resource:saved", {
64
64
  resource: this.resource,
65
- model: res.data.data,
65
+ model: res.data,
66
66
  });
67
67
 
68
- this.$router.replace({
69
- name: `${this.resource.routeName}.show`,
70
- params: { [this.resource.id]: res.data.id },
71
- });
68
+ const redirect = this.resource.form.redirect
69
+ ? this.resource.form.redirect({
70
+ resource: this.resource,
71
+ model: res.data,
72
+ form: this.form,
73
+ $store: this.$store,
74
+ $router: this.$router,
75
+ method: this.method,
76
+ })
77
+ : {
78
+ name: `${this.resource.routeName}.show`,
79
+ params: {
80
+ [this.resource.id]: res.data.id,
81
+ },
82
+ };
83
+
84
+ this.$router.replace(redirect);
72
85
  } catch (e) {
73
86
  console.log(e);
74
87
  } finally {
@@ -87,13 +87,26 @@ export default {
87
87
 
88
88
  this.emitter?.emit("resource:saved", {
89
89
  resource: this.resource,
90
- model: res.data.data,
90
+ model: res.data,
91
91
  });
92
92
 
93
- this.$router.replace({
94
- name: `${this.resource.routeName}.show`,
95
- params: { [this.resource.id]: res.data.id },
96
- });
93
+ const redirect = this.resource.form.redirect
94
+ ? this.resource.form.redirect({
95
+ resource: this.resource,
96
+ model: res.data,
97
+ form: this.form,
98
+ $store: this.$store,
99
+ $router: this.$router,
100
+ method: this.method,
101
+ })
102
+ : {
103
+ name: `${this.resource.routeName}.show`,
104
+ params: {
105
+ [this.resource.id]: res.data.id,
106
+ },
107
+ };
108
+
109
+ this.$router.replace(redirect);
97
110
  } catch (e) {
98
111
  console.log(e);
99
112
  } finally {
@@ -57,6 +57,7 @@ export function meta(name = "default", properties = {}) {
57
57
  form: {
58
58
  component: null,
59
59
  submit: null,
60
+ redirect: null,
60
61
  class: "grid__1/2",
61
62
  fields: () => ({}),
62
63
  preparation: ({ form }) => form.data(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-velocity",
3
- "version": "2.0.0-beta.55",
3
+ "version": "2.0.0-beta.56",
4
4
  "description": "Avalere Health branded style system",
5
5
  "scripts": {
6
6
  "setup": "npm ci || npm i && npm run content",