Skip to content

Commit

Permalink
client/api:
Browse files Browse the repository at this point in the history
update user db email
  • Loading branch information
evanyang1 authored and trillium committed Mar 4, 2024
1 parent 65bbd27 commit 5c39f73
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions client/src/api/UserApiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,29 @@ class UserApiService {
const requestOptions = {
method: 'PATCH',
headers: this.headers,
body: JSON.stringify({ isActive })
body: JSON.stringify({ isActive }),
};

try {
return await fetch(url, requestOptions);
} catch (err) {
console.error('update is-active error', err);
alert('server not responding. Please try again.');
}
}

async updateUserDbEmail(userToEdit, email) {
const url = `${this.baseUserUrl}${userToEdit._id}`;
const requestOptions = {
method: 'PATCH',
headers: this.headers,
body: JSON.stringify({ email }),
};

try {
return await fetch(url, requestOptions);
} catch (err) {
console.error('update is-active error', err)
console.error('update use email error', err);
alert('server not responding. Please try again.');
}
}
Expand Down

0 comments on commit 5c39f73

Please sign in to comment.