Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/pinia-orm/.eslintcache

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions packages/pinia-orm/src/store/Store.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { PiniaPlugin } from 'pinia'
import type { WeakCache } from '../cache/WeakCache'
import type { Model } from '../model/Model'
import { CONFIG_DEFAULTS, config } from './Config'
Expand Down Expand Up @@ -33,14 +34,16 @@ export interface CreatePiniaOrm {
/**
* Install Pinia ORM to the store.
*/
export function createORM (options?: InstallOptions) {
export function createORM (options?: InstallOptions): PiniaPlugin {
config.model = { ...CONFIG_DEFAULTS.model, ...options?.model }
config.cache = options?.cache === false ? false : { ...CONFIG_DEFAULTS.cache, ...(options?.cache !== true && options?.cache) }
const orm = {
use (plugin: PiniaOrmPlugin) {
const orm = () => {
function use (plugin: PiniaOrmPlugin) {
plugins.push(plugin)
return this
},
}
return {
use,
}
}
return () => orm
return orm
}