@data-fair/lib-vue 1.5.0 → 1.6.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.
Files changed (3) hide show
  1. package/fetch.d.ts +1 -1
  2. package/fetch.js +1 -0
  3. package/package.json +1 -1
package/fetch.d.ts CHANGED
@@ -4,7 +4,7 @@ type UseFetchOptions = {
4
4
  query?: QueryObject | Ref<QueryObject>;
5
5
  watch?: Boolean;
6
6
  };
7
- export declare function useFetch<T>(url: string | Ref<string>, options?: UseFetchOptions): {
7
+ export declare function useFetch<T>(url: string | Ref<string> | (() => string), options?: UseFetchOptions): {
8
8
  data: [T | null] extends [Ref<any, any>] ? import("@vue/shared").IfAny<Ref<any, any> & T, Ref<Ref<any, any> & T, Ref<any, any> & T>, Ref<any, any> & T> : Ref<import("vue").UnwrapRef<T> | null, T | import("vue").UnwrapRef<T> | null>;
9
9
  loading: Ref<boolean, boolean>;
10
10
  refresh: () => Promise<void>;
package/fetch.js CHANGED
@@ -4,6 +4,7 @@ import { computed, isRef, watch, ref } from 'vue'
4
4
  import { useUiNotif } from '@data-fair/lib-vue/ui-notif.js'
5
5
  export function useFetch (url, options = {}) {
6
6
  const { sendUiNotif } = useUiNotif()
7
+ if (typeof url === 'function') { url = computed(url) }
7
8
  const fullUrl = computed(() => {
8
9
  let fullUrl = isRef(url) ? url.value : url
9
10
  const query = isRef(options.query) ? options.query.value : options.query
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-vue",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Composables and other utilities for Vue applications in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "files": [