add name param in updateUser util

This commit is contained in:
Nathaniel Tampus
2023-04-05 21:03:42 +08:00
parent 2fadce8ae1
commit 3a6dad56d6

View File

@@ -91,16 +91,16 @@ export const logout = async () => {
}
};
export const updateUser = async (email?: string, password?: string) => {
export const updateUser = async (name?: string, email?: string, password?: string) => {
try {
if (!email && !password) return;
if (!name && !email && !password) return;
const res = await fetch(`${API_URL}/v1/auth/`, {
method: "PATCH",
credentials: "include",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ email, password })
body: JSON.stringify({ name, email, password })
});
if (res.status === 200) {
const user: User = await res.json();