Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 5x | import { create } from 'zustand'; interface IMovieStatus { favorite: boolean watchlist: boolean rated: boolean | {value: number} } interface IMovieStore { isFavorite: boolean isInWatchlist: boolean isRated: number | boolean | null setMovieStatus: (param: IMovieStatus) => void resetMovieStatus: () => void } const useMovieStore = create<IMovieStore>((set) => ({ isFavorite: false, isInWatchlist: false, isRated: null, setMovieStatus: (movieStatus) => set({ isFavorite: movieStatus.favorite, isInWatchlist: movieStatus.watchlist, isRated: typeof movieStatus.rated === 'boolean' ? movieStatus.rated : movieStatus.rated.value }), resetMovieStatus: () => set({ isFavorite: false, isInWatchlist: false, isRated: null, }) })) export default useMovieStore |