Skip to content

Commit

Permalink
Add fetch data in telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackIQ committed Jul 27, 2022
1 parent 4e7965f commit b936629
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/pages/tabs/telegram.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ const TelegramTab = () => {
const [telegramID, setTelegramID] = useState('');
const [openTelegramID, setOpenTelegramID] = useState(false);

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 @@ -51,11 +60,9 @@ const TelegramTab = () => {

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

setOpenTelegramID(false);

createSnack('Telegram Authentication is now enabled', 'success');
})
.catch((error) => {
Expand Down

0 comments on commit b936629

Please sign in to comment.