2021-07-08 12:21:44 +09:00

15 lines
370 B
TypeScript

import { useAtomValue } from 'jotai/utils'
import { activeServerAtom } from '@app/state/settings'
import { SubsonicApiClient } from '@app/subsonic/api'
export const useSubsonicApi = () => {
const activeServer = useAtomValue(activeServerAtom)
return () => {
if (!activeServer) {
return undefined
}
return new SubsonicApiClient(activeServer)
}
}