Skip to content

Commit

Permalink
feat: add console message for functions with missing returns
Browse files Browse the repository at this point in the history
  • Loading branch information
wobsoriano committed Nov 29, 2022
1 parent 32fd586 commit 8ebeb6d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/runtime/composables/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ export function useRemoteFunction (params: string, args: any[]) {
method: 'POST',
body: {
input: args
},
onResponse ({ response }) {
if (!response.ok && response.status === 404) {
const fn = params.split('.')[1]
// eslint-disable-next-line no-console
console.error(`[nuxt-remote-fn]: Make sure ${fn} returns any data.`)
}
}
})
}

0 comments on commit 8ebeb6d

Please sign in to comment.