mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-27 09:09:29 +01:00
15 lines
370 B
TypeScript
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)
|
|
}
|
|
}
|