dystcz / nuxt-sanctum-auth

Nuxt 3 + laravel sanctum authentication
134 stars 25 forks source link

Fix: $apiFetch promise returns void instead of dynamic type #15

Closed davide-granello closed 1 year ago

davide-granello commented 1 year ago

Fixed ApiFetch type, now returning Promise< T > instead of Promise< void >. This way main project can declare type returned by the promise dynamically. Example:

const fetchTest = async () => {
        // we now can define response type MyType 
        const response : MyType = await $apiFetch(`backend.test/api/test`, {
            method: 'GET'
        })
        // ...
    }
kreejzak commented 1 year ago

Thanks!