divhunt 2.0.12 → 2.0.14

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.
@@ -6,7 +6,7 @@ commands.Item({
6
6
  type: 'JSON',
7
7
  in: {
8
8
  id: ['string', null, true],
9
- data: ['object']
9
+ data: ['object', {}]
10
10
  },
11
11
  out: {
12
12
  data: ['string|object|boolean|number|array'],
@@ -29,7 +29,7 @@ commands.Item({
29
29
 
30
30
  try
31
31
  {
32
- const result = await commands.Item(properties.id).Fn('run', (properties.data || {}));
32
+ const result = await commands.Item(properties.id).Fn('run', properties.data, null, this);
33
33
 
34
34
  resolve({
35
35
  data: result.data,
@@ -88,8 +88,6 @@ divhunt.AddonReady('directives', function()
88
88
 
89
89
  methods.submit = async () =>
90
90
  {
91
- compile.data[config.bind];
92
-
93
91
  if(compile.data[config.bind].loading)
94
92
  {
95
93
  return;
@@ -98,8 +96,6 @@ divhunt.AddonReady('directives', function()
98
96
  compile.data[config.bind].loading = true;
99
97
  compile.data[config.bind].error = null;
100
98
 
101
- console.log(compile.data[config.bind]);
102
-
103
99
  compile.data.Update();
104
100
 
105
101
  try
@@ -109,6 +105,16 @@ divhunt.AddonReady('directives', function()
109
105
  ? await commands.Fn('api', config.command, formData)
110
106
  : await commands.Fn('run', config.command, formData);
111
107
 
108
+ if(result && result.code && result.code !== 200)
109
+ {
110
+ compile.data[config.bind].response = null;
111
+ compile.data[config.bind].error = result.message || 'Request failed.';
112
+ compile.data[config.bind].loading = false;
113
+
114
+ config.onError && config.onError(compile.data[config.bind]);
115
+ return;
116
+ }
117
+
112
118
  compile.data[config.bind].response = result;
113
119
  compile.data[config.bind].error = null;
114
120
  compile.data[config.bind].loading = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "divhunt",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
4
4
  "description": "Full-stack isomorphic JavaScript framework built from scratch. One addon abstraction powers databases, servers, commands, pages, directives, queues, and more.",
5
5
  "type": "module",
6
6
  "main": "lib/load.js",