perf: add type support to usePluginStore

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/3445/head
Ryan Wang 2022-07-18 16:12:54 +08:00
parent c15330f1e8
commit 82d966cba6
1 changed files with 7 additions and 3 deletions

View File

@ -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);
},
},