Foca 持久化 cookie 引擎,基于 document.cookie
API。
yarn add foca-cookie-storage
import { store } from 'foca';
import { cookieStorage, CookieStorage } from 'foca-cookie-storage';
store.init({
persist: [
{
key: 'my-project',
version: '1',
// 默认配置
engine: cookieStorage,
models: [],
},
{
key: 'my-project-1',
version: '1',
// 自定义配置
engine: new CookieStorage({
// ...
}),
models: [],
},
],
});