@iankibetsh/vue-streamline 1.2.8 → 1.3.0
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/App.vue +12 -8
- package/src/composables/useStreamline.js +25 -12
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -22,19 +22,23 @@ const findPaybill = async ()=>{
|
|
|
22
22
|
console.log(err)
|
|
23
23
|
})
|
|
24
24
|
}
|
|
25
|
+
const refresh = ()=>{
|
|
26
|
+
paybillService.refresh()
|
|
27
|
+
}
|
|
25
28
|
</script>
|
|
26
29
|
|
|
27
30
|
<template>
|
|
28
31
|
<div>
|
|
29
32
|
<hr/>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
<h3>Destructed: {{ testKey }}</h3>
|
|
34
|
+
<h3>Original: {{ props.testKey }}</h3>
|
|
35
|
+
<h3>Original: {{ props.testKey }}</h3>
|
|
36
|
+
<h3>Original: {{ props.testKey }}</h3>
|
|
37
|
+
<h3>Original: {{ props.testKey }}</h3>
|
|
38
|
+
<h3 class="text-success" >Loading : {{ loading }}</h3>
|
|
39
|
+
<h1 @click="findPaybill">Get Paybill</h1>
|
|
40
|
+
<h1 @click="refresh">Refresh</h1>
|
|
41
|
+
{{ foundPaybill }}
|
|
38
42
|
</div>
|
|
39
43
|
</template>
|
|
40
44
|
|
|
@@ -29,8 +29,10 @@ const useStreamline = (stream, ...initialArgs) => {
|
|
|
29
29
|
}
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
const fetchServiceProperties = async () => {
|
|
33
|
-
if
|
|
32
|
+
const fetchServiceProperties = async (force) => {
|
|
33
|
+
if(!force){
|
|
34
|
+
if (loading.value || propertiesFetched.value) return
|
|
35
|
+
}
|
|
34
36
|
|
|
35
37
|
try {
|
|
36
38
|
loading.value = true
|
|
@@ -62,6 +64,9 @@ const useStreamline = (stream, ...initialArgs) => {
|
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
return (...args) => {
|
|
67
|
+
if(prop === 'refresh' || prop === 'reload'){
|
|
68
|
+
return fetchServiceProperties(true)
|
|
69
|
+
}
|
|
65
70
|
if(prop === 'confirm'){
|
|
66
71
|
return confirmAction(args[0] ?? 'Are you sure?')
|
|
67
72
|
}
|
|
@@ -112,17 +117,25 @@ const useStreamline = (stream, ...initialArgs) => {
|
|
|
112
117
|
if(action.includes(':')){
|
|
113
118
|
[newStream, action] = action.split(':')
|
|
114
119
|
}
|
|
115
|
-
const
|
|
120
|
+
const post = {
|
|
116
121
|
action,
|
|
117
|
-
stream:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
stream:newStream,
|
|
123
|
+
params: args
|
|
124
|
+
}
|
|
125
|
+
return `${streamlineUrl}?${new URLSearchParams(post).toString()}`
|
|
126
|
+
|
|
127
|
+
// // Add each arg as a separate param
|
|
128
|
+
// args.forEach((arg, index) => {
|
|
129
|
+
// let value = arg;
|
|
130
|
+
// if (typeof arg === 'object' && !(arg instanceof Date)) {
|
|
131
|
+
// value = JSON.stringify(arg);
|
|
132
|
+
// } else if (arg instanceof Date) {
|
|
133
|
+
// value = arg.toISOString();
|
|
134
|
+
// }
|
|
135
|
+
// params.append(`params[${index}]`, value);
|
|
136
|
+
// })
|
|
137
|
+
|
|
138
|
+
// return `${streamlineUrl}?${params.toString()}`
|
|
126
139
|
}
|
|
127
140
|
|
|
128
141
|
const service = reactive({})
|