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 { defineStore } from "pinia";
|
||||||
|
import type { Plugin } from "@halo-dev/api-client";
|
||||||
|
|
||||||
|
interface PluginStoreState {
|
||||||
|
plugins: Plugin[];
|
||||||
|
}
|
||||||
|
|
||||||
export const usePluginStore = defineStore("plugin", {
|
export const usePluginStore = defineStore("plugin", {
|
||||||
state: () => ({
|
state: (): PluginStoreState => ({
|
||||||
plugins: [],
|
plugins: [],
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
registerPlugin(plugin) {
|
registerPlugin(plugin: Plugin) {
|
||||||
// @ts-ignore
|
|
||||||
this.plugins.push(plugin);
|
this.plugins.push(plugin);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue