@radiantabyss/vue 3.1.4 → 3.1.6
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/package.json +1 -1
- package/src/Invoke.js +22 -3
- package/src/Request.js +2 -2
- package/src/Validation/Response.js +0 -16
- package/src/Validation/Validator.js +0 -27
package/package.json
CHANGED
package/src/Invoke.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let sprite_version = import.meta.env.VITE_SPRITE_VERSION;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const invoke = async function(method, edge, payload = {}, display_errors = false) {
|
|
4
4
|
let _button;
|
|
5
5
|
if ( payload._button !== undefined ) {
|
|
6
6
|
_button = payload._button;
|
|
@@ -39,7 +39,12 @@ export default async function(edge, payload = {}, display_errors = false) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
try {
|
|
42
|
-
|
|
42
|
+
delete payload._event;
|
|
43
|
+
let data = await electron.IPC.invoke('invoke', {
|
|
44
|
+
method,
|
|
45
|
+
path: edge,
|
|
46
|
+
payload: JSON.stringify(payload),
|
|
47
|
+
});
|
|
43
48
|
|
|
44
49
|
if ( _button !== undefined ) {
|
|
45
50
|
_button.disabled = false;
|
|
@@ -49,8 +54,10 @@ export default async function(edge, payload = {}, display_errors = false) {
|
|
|
49
54
|
return data;
|
|
50
55
|
}
|
|
51
56
|
catch(e) {
|
|
57
|
+
e = e.toString().replace('Error: Error invoking remote method \'invoke\': ', '');
|
|
58
|
+
|
|
52
59
|
if ( display_errors ) {
|
|
53
|
-
Alert.error(
|
|
60
|
+
Alert.error(Str.nl2br(e), 7000);
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
if ( _button !== undefined ) {
|
|
@@ -61,3 +68,15 @@ export default async function(edge, payload = {}, display_errors = false) {
|
|
|
61
68
|
throw e;
|
|
62
69
|
}
|
|
63
70
|
}
|
|
71
|
+
|
|
72
|
+
let self = {
|
|
73
|
+
get(edge, payload = {}, display_errors = false) {
|
|
74
|
+
return invoke('GET', edge, payload, display_errors);
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
post(edge, payload = {}, display_errors = true) {
|
|
78
|
+
return invoke('POST', edge, payload, display_errors);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default self;
|
package/src/Request.js
CHANGED
|
@@ -197,11 +197,11 @@ let self = {
|
|
|
197
197
|
return request('GET', edge, payload, display_errors, base_url, auth_token, headers);
|
|
198
198
|
},
|
|
199
199
|
|
|
200
|
-
post(edge, payload = {}, display_errors =
|
|
200
|
+
post(edge, payload = {}, display_errors = true, base_url = null, auth_token = null, headers = {}) {
|
|
201
201
|
return request('POST', edge, payload, display_errors, base_url, auth_token, headers);
|
|
202
202
|
},
|
|
203
203
|
|
|
204
|
-
upload(edge, payload = {}, display_errors =
|
|
204
|
+
upload(edge, payload = {}, display_errors = true, upload_progress, base_url = null, auth_token = null, headers = {}) {
|
|
205
205
|
headers['Content-Type'] = 'multipart/form-data';
|
|
206
206
|
return request('POST', edge, payload, display_errors, base_url, auth_token, headers, upload_progress);
|
|
207
207
|
},
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as ValidatorJS from 'validatorjs';
|
|
2
|
-
|
|
3
|
-
let self = {
|
|
4
|
-
make(data, rules, messages) {
|
|
5
|
-
//format messages
|
|
6
|
-
let formatted_messages = {};
|
|
7
|
-
for ( let key in messages ) {
|
|
8
|
-
let split = key.split('.');
|
|
9
|
-
let pop = Array.from(split);
|
|
10
|
-
pop.pop();
|
|
11
|
-
formatted_messages[`${split[split.length - 1]}.${pop.join('.')}`] = messages[key];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let validator = new ValidatorJS(data, rules, formatted_messages);
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
passes() {
|
|
18
|
-
return validator.passes();
|
|
19
|
-
},
|
|
20
|
-
messages() {
|
|
21
|
-
return Object.values(validator.errors.all());
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default self;
|