Skip to content

Commit

Permalink
deletes user
Browse files Browse the repository at this point in the history
  • Loading branch information
meixingc committed Mar 23, 2023
1 parent 9bba312 commit e537d06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const App = () => {
<Route path="/profile" element=
{<Profile user={user}
authenticated={authenticated}/>} />
<Route path="/update" element={<UpdateProfile user={user}/>}/>
<Route path="/update" element={<UpdateProfile user={user} toggleAuthenticated={toggleAuthenticated}/>}/>
</Routes>
</main>
</div>
Expand Down
9 changes: 9 additions & 0 deletions client/src/pages/UpdateProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,17 @@ const UpdateProfile = (props) => {
isArtist: '',
avatar: ''
})
props.toggleAuthenticated(false)
navigate('/signin')
}

const deleteUser = async() => {
await axios.delete(`${URL}users/${props.user.user.id}`)
props.toggleAuthenticated(false)
navigate('/signin')

}

return (
<div className="register-card">
<div className="card-overlay centered">
Expand Down Expand Up @@ -126,6 +134,7 @@ const UpdateProfile = (props) => {
Update
</button>
</form>
<button onClick={deleteUser}>Delete Profile</button>
</div>
</div>
)
Expand Down

0 comments on commit e537d06

Please sign in to comment.