// my .tsx file
const {
data: thisData,
status: thisStatus,
error: thisError
} =
useQuery({
enabled: ready,
refetchOnWindowFocus: false,
queryKey: ['thisData'],
throwOnError: true,
retry: false,
queryFn: async () => {
const res = await api.soSomething(props)
return res.data
}
})// ApiClass.ts
export const MyApi = {
doSomething: async function( props: MyType) {
let jsonBody = JSON.stringify({
this: props.this,
that: props.that,
theOther: props.theOther,
})
let requestOptions = {
method: 'POST',
headers: headers,
body: jsonBody
}
const response = await fetch(URL + "/doSomething", requestOptions)
if( !response.ok ) {
console.log(ERROR: POST /doSomething .. ${response.status} , ${response.statusText})
throw new Error(response.statusText)
}
return response.json()
}
}https://x.com/tan_stack/status/2031128535470104577?s=20
dry-scarlet · 7h ago
https://x.com/powersync_/status/2010721010006552775?s=20
dry-scarlet · 2mo ago
You can now submit your website/app/project to http://TanStack.com 's new showcase and have it seen by the TanStack community! - Global showcase browser - Per-library filters - Category filters Submit here: https://tanstack.com/showcase/submit View all here: https://tanstack.com/showcase
dry-scarlet · 3mo ago