added pinia store
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createApp } from "vue";
|
||||
//import { createPinia } from 'pinia'
|
||||
import { createPinia } from "pinia";
|
||||
|
||||
import App from "./App.vue";
|
||||
import router from "./router";
|
||||
@@ -16,7 +16,7 @@ import "/src/scss/custom.scss";
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
//app.use(createPinia())
|
||||
app.use(createPinia());
|
||||
app.use(router);
|
||||
app.use(store);
|
||||
|
||||
|
@@ -1,16 +0,0 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useCounterStore = defineStore({
|
||||
id: 'counter',
|
||||
state: () => ({
|
||||
counter: 0
|
||||
}),
|
||||
getters: {
|
||||
doubleCount: (state) => state.counter * 2
|
||||
},
|
||||
actions: {
|
||||
increment() {
|
||||
this.counter++
|
||||
}
|
||||
}
|
||||
})
|
28
src/stores/infoState.ts
Normal file
28
src/stores/infoState.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export type infoState = {
|
||||
statuscode: number;
|
||||
message: string;
|
||||
type: "error" | "success" | "warning";
|
||||
};
|
||||
|
||||
export type RootState = {
|
||||
infoState: infoState[];
|
||||
};
|
||||
|
||||
export const useInfoStateStore = defineStore({
|
||||
id: "infoState",
|
||||
state: () =>
|
||||
({
|
||||
infoState: [],
|
||||
} as RootState),
|
||||
actions: {
|
||||
addInfo(payload: infoState) {
|
||||
this.infoState.push(payload);
|
||||
},
|
||||
removeInfo(id: number) {
|
||||
this.infoState.splice(id, 1);
|
||||
},
|
||||
},
|
||||
getters: {},
|
||||
});
|
16
src/stores/matchDetails.ts
Normal file
16
src/stores/matchDetails.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { defineStore } from "pinia";
|
||||
import type { Match } from "@/api";
|
||||
|
||||
export type RootState = {
|
||||
matchDetails: Match;
|
||||
};
|
||||
|
||||
export const useMatchDetailsStore = defineStore({
|
||||
id: "matchDetails",
|
||||
state: () =>
|
||||
({
|
||||
matchDetails: {},
|
||||
} as RootState),
|
||||
actions: {},
|
||||
getters: {},
|
||||
});
|
16
src/stores/playerDetails.ts
Normal file
16
src/stores/playerDetails.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { defineStore } from "pinia";
|
||||
import type { Player } from "@/api";
|
||||
|
||||
export type RootState = {
|
||||
playerDetails: Player;
|
||||
};
|
||||
|
||||
export const usePlayerDetailsStore = defineStore({
|
||||
id: "playerDetails",
|
||||
state: () =>
|
||||
({
|
||||
playerDetails: {},
|
||||
} as RootState),
|
||||
actions: {},
|
||||
getters: {},
|
||||
});
|
16
src/stores/playersArr.ts
Normal file
16
src/stores/playersArr.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { defineStore } from "pinia";
|
||||
import type { Player } from "@/api";
|
||||
|
||||
export type RootState = {
|
||||
playersArr: Player[];
|
||||
};
|
||||
|
||||
export const usePlayersArrStore = defineStore({
|
||||
id: "playersArr",
|
||||
state: () =>
|
||||
({
|
||||
playersArr: [],
|
||||
} as RootState),
|
||||
actions: {},
|
||||
getters: {},
|
||||
});
|
15
src/stores/scrollState.ts
Normal file
15
src/stores/scrollState.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export type RootState = {
|
||||
scrollState: number;
|
||||
};
|
||||
|
||||
export const useScrollStateStore = defineStore({
|
||||
id: "scrollState",
|
||||
state: () =>
|
||||
({
|
||||
scrollState: 0,
|
||||
} as RootState),
|
||||
actions: {},
|
||||
getters: {},
|
||||
});
|
17
src/stores/searchParams.ts
Normal file
17
src/stores/searchParams.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export type RootState = {
|
||||
id64: string;
|
||||
vanity_url: string;
|
||||
};
|
||||
|
||||
export const useSearchParamsStore = defineStore({
|
||||
id: "searchParams",
|
||||
state: () =>
|
||||
({
|
||||
id64: "",
|
||||
vanity_url: "",
|
||||
} as RootState),
|
||||
actions: {},
|
||||
getters: {},
|
||||
});
|
Reference in New Issue
Block a user