Skip to content

Commit

Permalink
Fix/notification auth failing/sov 970 (#2462)
Browse files Browse the repository at this point in the history
* Fix for failing auth

* Revert changes from commit c3321f1
  • Loading branch information
BetsyBraddock authored Dec 5, 2022
1 parent 7d59e37 commit 631ff18
Showing 1 changed file with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,33 @@ export const NotificationSettingsDialog: React.FC<INotificationSettingsDialogPro
if (!account) return;
const timestamp = new Date();
const message = `Login to backend on: ${timestamp}`;
return axios
.get(url + 'user/isUser/' + account)
.then(alreadyUser =>
walletService.signMessage(message).then(signedMessage =>
axios
.post(url + 'user/' + (alreadyUser ? 'auth' : 'register'), {
signedMessage,
message,
walletAddress: account,
})
.then(res => {
if (res.data && res.data.token) {
dispatch(
actions.setNotificationToken({
token: res.data.token,
wallet: account,
}),
);
}
}),
),
)
const { data: alreadyUser } = await axios.get(
url + 'user/isUser/' + account,
);
walletService
.signMessage(message)
.then(signedMessage => {
axios
.post(url + 'user/' + (alreadyUser ? 'auth' : 'register'), {
signedMessage,
message,
walletAddress: account,
})
.then(res => {
if (res.data && res.data.token) {
dispatch(
actions.setNotificationToken({
token: res.data.token,
wallet: account,
}),
);
}
})
.catch(error => {
console.error(error);
onClose();
});
})
.catch(error => {
console.error(error);
onClose();
Expand Down

0 comments on commit 631ff18

Please sign in to comment.