function useCheckSpotify(isCheckingSpotifyAccountConnection: boolean) {
return useQuery({
queryKey: ['isSpotifyAccountConnected'],
queryFn: async () => {
const response = await Axios({
method: 'GET',
url: api/user/checkSpotify,
});
console.log('at useCheckSpotify: response.data.data', response.data.data);
if (response.data.data.exists === false) {
// no connection yet
window.open(response.data.data.url);
}
if (response.data.data.exists === true) {
// the connection exists already
console.log('at useCheckSpotify: Connection exists');
//@ts-ignore
generalStore.sendEventToSourceCategoryStateMachine('CONNECTING_COMPLETED');
}
return response.data.data;
},
enabled: isCheckingSpotifyAccountConnection,
refetchOnWindowFocus: false,
refetchInterval: data => {
if (data) {
console.log('at useCheckSpotify: Connection exists');
generalStore.sendEventToSourceCategoryStateMachine('CONNECTING_COMPLETED');
return false;
}
console.log('at useCheckSpotify: re-fetching while connection does not exist');
return 600; //refetch interval in milliseconds
},
...defaultQueryConfig,
});
}
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