mirror of
https://github.com/remvze/moodist.git
synced 2025-12-18 09:24:14 +00:00
fix: remove extra hook
This commit is contained in:
parent
1f2b6b952c
commit
3ef4a076a2
1 changed files with 0 additions and 20 deletions
|
|
@ -1,20 +0,0 @@
|
||||||
import { useCallback } from 'react';
|
|
||||||
|
|
||||||
import { useSound } from './use-sound';
|
|
||||||
import { useAlarmStore } from '@/stores/alarm';
|
|
||||||
|
|
||||||
export function useAlarm() {
|
|
||||||
const { play: playSound } = useSound('/sounds/alarm.mp3', { volume: 1 });
|
|
||||||
const isPlaying = useAlarmStore(state => state.isPlaying);
|
|
||||||
const play = useAlarmStore(state => state.play);
|
|
||||||
const stop = useAlarmStore(state => state.stop);
|
|
||||||
|
|
||||||
const playAlarm = useCallback(() => {
|
|
||||||
if (!isPlaying) {
|
|
||||||
playSound(stop);
|
|
||||||
play();
|
|
||||||
}
|
|
||||||
}, [isPlaying, playSound, play, stop]);
|
|
||||||
|
|
||||||
return playAlarm;
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue