mirror of
https://github.com/remvze/moodist.git
synced 2025-12-17 08:54:13 +00:00
20 lines
565 B
TypeScript
20 lines
565 B
TypeScript
import { create } from 'zustand';
|
|
import { createJSONStorage, persist } from 'zustand/middleware';
|
|
|
|
import { type FavoriteState, createState } from './favorite.state';
|
|
import { type FavoriteActions, createActions } from './favorite.actions';
|
|
|
|
export const useFavoriteStore = create<FavoriteState & FavoriteActions>()(
|
|
persist(
|
|
(...a) => ({
|
|
...createState(...a),
|
|
...createActions(...a),
|
|
}),
|
|
{
|
|
name: 'moodist-favorites',
|
|
skipHydration: true,
|
|
storage: createJSONStorage(() => localStorage),
|
|
version: 0,
|
|
},
|
|
),
|
|
);
|