Skip to content

Commit

Permalink
update profile
Browse files Browse the repository at this point in the history
  • Loading branch information
meixingc committed Mar 23, 2023
1 parent fe196a5 commit aba2d9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { CheckSession } from './services/auth'
import './styles/App.css'
import { DataContext } from './DataContext'
import { RegisterUser } from './services/auth'
import UpdateProfile from './pages/UpdateProfile'

import Profile from './pages/Profile'

Expand Down Expand Up @@ -158,6 +159,7 @@ const App = () => {
<Route path="/profile" element=
{<Profile user={user}
authenticated={authenticated}/>} />
<Route path="/update" element={<UpdateProfile user={user}/>}/>
</Routes>
</main>
</div>
Expand Down
6 changes: 4 additions & 2 deletions client/src/pages/UpdateProfile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { useState } from 'react'
import { UpdateUser } from '../services/auth.js'
import { useNavigate } from 'react-router-dom'
import axios from 'axios'

const UpdateProfile = () => {
const UpdateProfile = (props) => {
const URL = `http://localhost:3001/`

let navigate = useNavigate()

Expand All @@ -19,7 +21,7 @@ const UpdateProfile = () => {

const handleSubmit = async (e) => {
e.preventDefault()
await UpdateUser({
await axios.put(`${URL}users/${props.user.user.id}`,{
name: formValues.name,
email: formValues.email,
passwordInput: formValues.password,
Expand Down

0 comments on commit aba2d9b

Please sign in to comment.