mirror of
https://github.com/Jellify-Music/App.git
synced 2025-12-30 15:29:49 -06:00
* Ad ability to long press and delete a playlist also can delete a playlist within the playlist screen itself adds some more fun loading messages and "pull to refresh" text
31 lines
900 B
TypeScript
31 lines
900 B
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import { INFO_CAPTIONS } from '../configs/info.config'
|
|
import { ONE_HOUR } from '../constants/query-client'
|
|
import { pickRandomItemFromArray } from '../utils/random'
|
|
import { LOADING_CAPTIONS } from '../configs/loading.config'
|
|
|
|
enum CaptionQueryKeys {
|
|
InfoCaption,
|
|
LoadingCaption,
|
|
}
|
|
|
|
export const useInfoCaption = () =>
|
|
useQuery({
|
|
queryKey: [CaptionQueryKeys.InfoCaption],
|
|
queryFn: () => `${pickRandomItemFromArray(INFO_CAPTIONS)}`,
|
|
staleTime: ONE_HOUR,
|
|
initialData: 'Live and in stereo',
|
|
refetchOnMount: 'always',
|
|
refetchOnWindowFocus: 'always',
|
|
})
|
|
|
|
export const useLoadingCaption = () =>
|
|
useQuery({
|
|
queryKey: [CaptionQueryKeys.LoadingCaption],
|
|
queryFn: () => `${pickRandomItemFromArray(LOADING_CAPTIONS)}`,
|
|
staleTime: 0,
|
|
initialData: 'Reticulating splines',
|
|
refetchOnMount: 'always',
|
|
refetchOnWindowFocus: 'always',
|
|
})
|