@hostlink/nuxt-light 1.48.11 → 1.48.12

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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.48.11",
4
+ "version": "1.48.12",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -23,9 +23,10 @@ let redirect = true;
23
23
  if (props.context.attrs.onSubmitted) {
24
24
  redirect = false;
25
25
  }
26
+ const modelName = props.context.attrs.modelName || (typeof route.name === "string" ? route.name.split("-")[0] : void 0);
27
+ const id = props.context.attrs.modelId || route.params[typeof route.name === "string" ? route.name.split("-")[1] : "id"];
26
28
  if (!props.context.onSubmit) {
27
29
  props.context.node.props.onSubmit = async function() {
28
- const [module, id_name] = route.name.split("-");
29
30
  const removeUndefined = (obj) => {
30
31
  if (obj === null || obj === void 0) {
31
32
  return obj;
@@ -50,8 +51,8 @@ if (!props.context.onSubmit) {
50
51
  };
51
52
  const v = removeUndefined(props.context.value);
52
53
  try {
53
- if (route.params[id_name]) {
54
- if (await model(module).update(Number(route.params[id_name]), v)) {
54
+ if (id) {
55
+ if (await model(modelName).update(Number(id), v)) {
55
56
  quasar.notify({
56
57
  message: "Updated successfully",
57
58
  color: "positive",
@@ -62,7 +63,7 @@ if (!props.context.onSubmit) {
62
63
  }
63
64
  }
64
65
  } else {
65
- if (await model(module).add(v)) {
66
+ if (await model(modelName).add(v)) {
66
67
  quasar.notify({
67
68
  message: "Added successfully",
68
69
  color: "positive",
@@ -107,7 +107,9 @@ export const createLightPlugin = () => {
107
107
  "submit",
108
108
  "onSubmit",
109
109
  "gutter",
110
- "bordered"
110
+ "bordered",
111
+ "modelName",
112
+ "modelId"
111
113
  ],
112
114
  features: [forms, disablesChildren]
113
115
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.48.11",
3
+ "version": "1.48.12",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",