summaryrefslogtreecommitdiff
path: root/src/common/stores/useLoginStore.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/stores/useLoginStore.ts')
-rw-r--r--src/common/stores/useLoginStore.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/common/stores/useLoginStore.ts b/src/common/stores/useLoginStore.ts
new file mode 100644
index 0000000..7b4551c
--- /dev/null
+++ b/src/common/stores/useLoginStore.ts
@@ -0,0 +1,26 @@
+import { create } from "zustand";
+
+type State = {
+ form: {
+ username: string;
+ password: string;
+ };
+};
+
+type Action = {
+ updateForm: (name: string, value: string) => void;
+};
+
+export const useLoginStore = create<State & Action>((set) => ({
+ form: {
+ username: "",
+ password: "",
+ },
+ updateForm: (name, value) =>
+ set((state) => ({
+ form: {
+ ...state.form,
+ [name]: value,
+ },
+ })),
+}));