cra-template-demplate
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "cra-template-demplate", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "react", |
@@ -1,2 +0,3 @@ | ||
import {applyMiddleWares, logMiddleware, persistMiddlewareCreator, StoreInterface} from '@/utils/zustand'; | ||
import {applyMiddleware, logMiddleware, StoreInterface} from '@/utils/zustand'; | ||
import {syncMiddlewareCreator} from '@/utils/syncMiddleware'; | ||
@@ -22,7 +23,8 @@ export enum Locale { | ||
export const useLocaleStore = applyMiddleWares<Store>(store, [ | ||
persistMiddlewareCreator({ | ||
name: 'locale' | ||
export const useLocaleStore = applyMiddleware<Store>(store, [ | ||
syncMiddlewareCreator({ | ||
name: 'locale', | ||
syncDynamically: true | ||
}), | ||
logMiddleware | ||
]); |
@@ -1,2 +0,2 @@ | ||
import {applyMiddleWares, logMiddleware, StoreInterface} from '@/utils/zustand'; | ||
import {applyMiddleware, logMiddleware, StoreInterface} from '@/utils/zustand'; | ||
import {sleep} from '@/utils'; | ||
@@ -30,5 +30,5 @@ import {testMiddleware} from '@/middleware/test'; | ||
export const useTestStore = applyMiddleWares<Test>(store, [ | ||
export const useTestStore = applyMiddleware<Test>(store, [ | ||
logMiddleware, | ||
testMiddleware | ||
]); |
import create, {GetState, SetState, StateCreator, StoreApi} from 'zustand'; | ||
import {persist, PersistOptions} from 'zustand/middleware'; | ||
import {log} from '@/utils/index'; | ||
@@ -16,3 +15,3 @@ | ||
export const applyMiddleWares = <T extends {}>(s: StoreInterface<T>, middlewares: Middleware<T>[]) => create<T>( | ||
export const applyMiddleware = <T extends {}>(s: StoreInterface<T>, middlewares: Middleware<T>[]) => create<T>( | ||
middlewares.reduce((a, m) => m(a), s) | ||
@@ -31,3 +30,1 @@ ); | ||
}, get, store, $$storeMutations); | ||
export const persistMiddlewareCreator = <T extends {}>(options: PersistOptions<T>) => (s: StoreInterface<T>) => persist<T>(s, options); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51566
39
877