mirror of https://github.com/halo-dev/halo
perf: add type support to usePluginStore
Signed-off-by: Ryan Wang <i@ryanc.cc>pull/3445/head
parent
c15330f1e8
commit
82d966cba6
|
@ -1,12 +1,16 @@
|
|||
import { defineStore } from "pinia";
|
||||
import type { Plugin } from "@halo-dev/api-client";
|
||||
|
||||
interface PluginStoreState {
|
||||
plugins: Plugin[];
|
||||
}
|
||||
|
||||
export const usePluginStore = defineStore("plugin", {
|
||||
state: () => ({
|
||||
state: (): PluginStoreState => ({
|
||||
plugins: [],
|
||||
}),
|
||||
actions: {
|
||||
registerPlugin(plugin) {
|
||||
// @ts-ignore
|
||||
registerPlugin(plugin: Plugin) {
|
||||
this.plugins.push(plugin);
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue