@iankibetsh/vue-streamline 1.2.6 → 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.6",
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": {
@@ -57,11 +57,6 @@ const useStreamline = (stream, ...initialArgs) => {
57
57
 
58
58
  const handler = {
59
59
  get(target, prop, receiver) {
60
- // Fetch properties if not already fetched
61
- if (!propertiesFetched.value && !loading.value) {
62
- fetchServiceProperties().then(() => target[prop])
63
- }
64
-
65
60
  if (prop in target) {
66
61
  return target[prop]
67
62
  }
@@ -113,14 +108,23 @@ const useStreamline = (stream, ...initialArgs) => {
113
108
  }
114
109
  }
115
110
  const getActionUrl = (action, ...args) => {
116
- // console.log('getActionUrl called with:', action, args);
117
- const post = {
118
- action,
119
- stream,
120
- params: args
111
+ let newStream = stream
112
+ if(action.includes(':')){
113
+ [newStream, action] = action.split(':')
121
114
  }
122
- 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()}`
123
126
  }
127
+
124
128
  const service = reactive({})
125
129
 
126
130
  // Confirmation wrapper