diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-11-09 15:40:16 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-11-09 15:40:16 +0700 |
| commit | be0f537dc4fe384eef09436833c6407e6482c16d (patch) | |
| tree | 194b1ad3f34396cb8149075bbbd38b854aedf361 /src/common/stores/useLoginStore.ts | |
| parent | 5d5401ae36e7e0c8eb38ccd943c1aa44a9573d35 (diff) | |
Initial commit
Diffstat (limited to 'src/common/stores/useLoginStore.ts')
| -rw-r--r-- | src/common/stores/useLoginStore.ts | 26 |
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, + }, + })), +})); |
