Skip to content

Commit

Permalink
refactor(ui): refactor commonStore in counter.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiinaKin committed Oct 28, 2024
1 parent 7cdd09c commit cedf57d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions ui/src/stores/counter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import { ref, computed } from "vue";
import { defineStore } from "pinia";

export const useCounterStore = defineStore("counter", () => {
const count = ref(0);
const doubleCount = computed(() => count.value * 2);
function increment() {
count.value++;
}

return { count, doubleCount, increment };
export const useCommonStore = defineStore("common", () => {
const title = ref("HoshizoraPics");
const setTitle = (newTitle: string) => {
title.value = newTitle;
};

const subTitle = ref("A simple pic management");
const setSubTitle = (newTitle: string) => {
subTitle.value = newTitle;
};

const allowSignup = ref(false);
const setAllowSignup = (newAllowSignup: boolean) => {
allowSignup.value = newAllowSignup;
};

return { title, setTitle, subTitle, setSubTitle, allowSignup, setAllowSignup };
});
});

0 comments on commit cedf57d

Please sign in to comment.