mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-14 12:14:40 +01:00
580 B
580 B
title
| title |
|---|
| Aborting Procedures |
Aborting Procedures
tRPC adheres to the industry standard when it comes to aborting procedures. All you have to do is pass an AbortSignal to the query-options and then call its parent AbortController's abort method.
export default function useGetTodo(id: number) {
const { $client } = useNuxtApp()
const ac = new AbortController()
onScopeDispose(() => {
ac.abort()
})
return useAsyncData(() => {
return $client.todo.getTodo.query(id, {
signal: ac.signal
})
})
}