Skip to content

Commit

Permalink
Add fetch data settings
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackIQ committed Jul 27, 2022
1 parent b936629 commit 9f048c0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pages/tabs/settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ const SettingsTab = () => {
const [email, setEmail] = useState(user.email);
const [password, setPassword] = useState(user.password);

Axios.post(`${env.REACT_APP_BACKEND_API}/user/info`, {id: uid})
.then((result) => {
const data = result.data;
dispatch(createUser(data));
})
.catch((error) => {
console.log(error);
});

// Snackbar
const [openSnack, setOpenSnack] = useState(false);
const [messageSnack, setMessageSnack] = useState('');
Expand All @@ -48,7 +57,6 @@ const SettingsTab = () => {

Axios.post(`${env.REACT_APP_BACKEND_API}/user/update`, data)
.then((result) => {
console.log(result);
dispatch(createUser(result));

createSnack('Data updated', 'success');
Expand Down

0 comments on commit 9f048c0

Please sign in to comment.