add name param in updateUser util
This commit is contained in:
@@ -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 {
|
try {
|
||||||
if (!email && !password) return;
|
if (!name && !email && !password) return;
|
||||||
const res = await fetch(`${API_URL}/v1/auth/`, {
|
const res = await fetch(`${API_URL}/v1/auth/`, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ email, password })
|
body: JSON.stringify({ name, email, password })
|
||||||
});
|
});
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const user: User = await res.json();
|
const user: User = await res.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user