@iankibetsh/vue-streamline 1.2.4 → 1.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/vue-streamline",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "Vue library for streamlining laravel backend services with @iankibet/streamline composer package",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -2,7 +2,7 @@
2
2
  import useStreamline from './composables/useStreamline.js'
3
3
  import { onMounted, ref, toRefs } from 'vue'
4
4
 
5
- const {loading, service:paybillService, getActionUrl,props,confirmAction} = useStreamline('mpesa/paybill')
5
+ const {loading, service:paybillService, getActionUrl,props,confirmAction} = useStreamline('mpesa/paybill',true)
6
6
 
7
7
 
8
8
  const foundPaybill = ref(null)
@@ -27,14 +27,14 @@ const findPaybill = async ()=>{
27
27
  <template>
28
28
  <div>
29
29
  <hr/>
30
- <h3>Destructed: {{ testKey }}</h3>
31
- <h3>Original: {{ props.testKey }}</h3>
32
- <h3>Original: {{ props.testKey }}</h3>
33
- <h3>Original: {{ props.testKey }}</h3>
34
- <h3>Original: {{ props.testKey }}</h3>
35
- <h3 class="text-success" >Loading : {{ loading }}</h3>
36
- <h1 @click="findPaybill">Get Paybill</h1>
37
- {{ foundPaybill }}
30
+ <!-- <h3>Destructed: {{ testKey }}</h3>-->
31
+ <!-- <h3>Original: {{ props.testKey }}</h3>-->
32
+ <!-- <h3>Original: {{ props.testKey }}</h3>-->
33
+ <!-- <h3>Original: {{ props.testKey }}</h3>-->
34
+ <!-- <h3>Original: {{ props.testKey }}</h3>-->
35
+ <!-- <h3 class="text-success" >Loading : {{ loading }}</h3>-->
36
+ <!-- <h1 @click="findPaybill">Get Paybill</h1>-->
37
+ <!-- {{ foundPaybill }}-->
38
38
  </div>
39
39
  </template>
40
40
 
@@ -112,7 +112,15 @@ const useStreamline = (stream, ...initialArgs) => {
112
112
  }
113
113
  }
114
114
  }
115
-
115
+ const getActionUrl = (action, ...args) => {
116
+ // console.log('getActionUrl called with:', action, args);
117
+ const post = {
118
+ action,
119
+ stream,
120
+ params: args
121
+ }
122
+ return `${streamlineUrl}?${new URLSearchParams(post).toString()}`
123
+ }
116
124
  const service = reactive({})
117
125
 
118
126
  // Confirmation wrapper
@@ -122,19 +130,20 @@ const useStreamline = (stream, ...initialArgs) => {
122
130
  }
123
131
 
124
132
  onMounted(() => {
133
+ if (initialArgs.length > 0) {
134
+ fetchServiceProperties()
135
+ }
125
136
  if (!enableCache) return
126
137
  const cachedData = localStorage.getItem(cacheKey)
127
138
  if (cachedData) {
128
139
  assignProperties(JSON.parse(cachedData))
129
140
  }
130
- if (initialArgs.length > 0) {
131
- fetchServiceProperties()
132
- }
133
141
  })
134
142
 
135
143
  return {
136
144
  loading,
137
145
  service: new Proxy(service, handler),
146
+ getActionUrl,
138
147
  confirmAction,
139
148
  props
140
149
  }