@iankibetsh/vue-streamline 1.2.7 → 1.2.8

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/README.md CHANGED
@@ -66,7 +66,22 @@ getActionUrl('getTasks', 'active')
66
66
  ```
67
67
 
68
68
  ## Accessing class properties
69
- In your template just access the props object to get the class properties
69
+ You can access the class properties defined in the service class using the props object returned by the useStreamline function
70
+ ### In your script
71
+ Access the props object to get the class properties, use computed to make it reactive
72
+ ```js
73
+ const title = computed(() => props.title)
74
+ ```
75
+ Then use it in your template
76
+ ```html
77
+ <template>
78
+ <div>
79
+ <h1>{{title}}</h1>
80
+ </div>
81
+ </template>
82
+ ```
83
+ ### Directly in your template
84
+ In your template just access the props object to get the class properties. Prefer using computed to make it reactive
70
85
  ```html
71
86
  <template>
72
87
  <div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/vue-streamline",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "Vue library for streamlining laravel backend services with @iankibet/streamline composer package",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -108,14 +108,23 @@ const useStreamline = (stream, ...initialArgs) => {
108
108
  }
109
109
  }
110
110
  const getActionUrl = (action, ...args) => {
111
- // console.log('getActionUrl called with:', action, args);
112
- const post = {
113
- action,
114
- stream,
115
- params: args
111
+ let newStream = stream
112
+ if(action.includes(':')){
113
+ [newStream, action] = action.split(':')
116
114
  }
117
- return `${streamlineUrl}?${new URLSearchParams(post).toString()}`
115
+ const params = new URLSearchParams({
116
+ action,
117
+ stream: newStream
118
+ })
119
+
120
+ // Add each arg as a separate param
121
+ args.forEach((arg, index) => {
122
+ params.append(`params[${index}]`, typeof arg === 'object' ? JSON.stringify(arg) : arg)
123
+ })
124
+
125
+ return `${streamlineUrl}?${params.toString()}`
118
126
  }
127
+
119
128
  const service = reactive({})
120
129
 
121
130
  // Confirmation wrapper