bug fix + use id instead of username for lookup

This commit is contained in:
Daniel
2023-07-19 12:14:52 -04:00
parent 01a8579158
commit 35bece5f49
13 changed files with 24 additions and 29 deletions
+3 -3
View File
@@ -8,14 +8,14 @@ type ResponseObject = {
type AccountStore = {
account: AccountSettings;
setAccount: (username: string) => void;
setAccount: (id: number) => void;
updateAccount: (user: AccountSettings) => Promise<ResponseObject>;
};
const useAccountStore = create<AccountStore>()((set) => ({
account: {} as AccountSettings,
setAccount: async (username) => {
const response = await fetch(`/api/routes/users?username=${username}`);
setAccount: async (id) => {
const response = await fetch(`/api/routes/users?id=${id}`);
const data = await response.json();