added toasts popups + improved login/signup page + many more changes and improvements

This commit is contained in:
Daniel
2023-06-27 02:03:40 +03:30
parent 0ddd9079bf
commit f1bd48be83
28 changed files with 464 additions and 199 deletions
+7 -4
View File
@@ -1,10 +1,15 @@
import { create } from "zustand";
import { AccountSettings } from "@/types/global";
type ResponseObject = {
ok: boolean;
data: object | string;
};
type AccountStore = {
account: AccountSettings;
setAccount: (email: string) => void;
updateAccount: (user: AccountSettings) => Promise<boolean>;
updateAccount: (user: AccountSettings) => Promise<ResponseObject>;
};
const useAccountStore = create<AccountStore>()((set) => ({
@@ -29,11 +34,9 @@ const useAccountStore = create<AccountStore>()((set) => ({
const data = await response.json();
console.log(data);
if (response.ok) set({ account: { ...data.response } });
return response.ok;
return { ok: response.ok, data: data.response };
},
}));