From 3a6dad56d635fbb6f01b57d4a796a648a7b965e8 Mon Sep 17 00:00:00 2001 From: Nathaniel Tampus Date: Wed, 5 Apr 2023 21:03:42 +0800 Subject: [PATCH] add name param in updateUser util --- client/src/lib/auth.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/lib/auth.ts b/client/src/lib/auth.ts index b20fc1b..1df17b0 100644 --- a/client/src/lib/auth.ts +++ b/client/src/lib/auth.ts @@ -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();