mirror of
https://github.com/navidrome/navidrome.git
synced 2025-08-10 00:52:20 +00:00
19 lines
497 B
JavaScript
19 lines
497 B
JavaScript
import { useEffect } from 'react'
|
|
import { useDispatch } from 'react-redux'
|
|
import subsonic from '../subsonic'
|
|
import { scanStatusUpdate } from '../actions'
|
|
|
|
export const useInitialScanStatus = () => {
|
|
const dispatch = useDispatch()
|
|
useEffect(() => {
|
|
subsonic
|
|
.getScanStatus()
|
|
.then((resp) => resp.json['subsonic-response'])
|
|
.then((data) => {
|
|
if (data.status === 'ok') {
|
|
dispatch(scanStatusUpdate(data.scanStatus))
|
|
}
|
|
})
|
|
}, [dispatch])
|
|
}
|