Date: Sun, 10 Dec 2023 04:34:15 +0530
Subject: [PATCH 2/2] discord alert added
---
.../src/components/ConnectWalltet/Walltet.jsx | 3 +-
.../src/components/Onboarding/Onboarding.jsx | 36 +++++++++++++++++--
frontend/yarn.lock | 5 ---
3 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/frontend/src/components/ConnectWalltet/Walltet.jsx b/frontend/src/components/ConnectWalltet/Walltet.jsx
index ab57ccf..1a49e77 100644
--- a/frontend/src/components/ConnectWalltet/Walltet.jsx
+++ b/frontend/src/components/ConnectWalltet/Walltet.jsx
@@ -19,8 +19,7 @@ const ConnectWalletButton = ({
}}
disabled
>
- Loading...
+ Loading...
) : (
{
const [selectedProtocols, setSelectedProtocols] = useState([]);
const [slackWebhook, setSlackWebhook] = useState('');
const [emailAddress, setEmailAddress] = useState('');
+ const [discordWebhook, setDiscordWebhook] = useState('');
const handleClose = () => {
setOpen(false);
};
@@ -35,6 +36,11 @@ const Onboarding = ({ open, setOpen, signer }) => {
event.stopPropagation();
setEmailAddress(event.target.value);
};
+ const handleDiscordWebhookChange = (event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ setDiscordWebhook(event.target.value);
+ }
const handleNext = async () => {
if (selectedProtocols.includes('Slack') && !slackWebhook) {
@@ -43,7 +49,7 @@ const Onboarding = ({ open, setOpen, signer }) => {
}
selectedProtocols.includes('Slack') && axios.post('https://finsafe-backend.insidefi.io/alert/slack/subscribe', { webhook: slackWebhook }, { headers: { 'Content-Type': 'application/json', authorization: `Bearer ${localStorage.getItem('token')}` } });
-
+ selectedProtocols.includes('Discord') && axios.post('https://finsafe-backend.insidefi.io/alert/discord/subscribe', { webhook: discordWebhook }, { headers: { 'Content-Type': 'application/json', authorization: `Bearer ${localStorage.getItem('token')}` } });
if (selectedProtocols.includes('Email') && !emailAddress) {
alert('Please enter email address');
return;
@@ -82,7 +88,7 @@ const Onboarding = ({ open, setOpen, signer }) => {
width: '100%',
}}
>
-
Select Push Protocols
+ Select Alert Prefrences
{
value="Alerts"
/>
}
- label="Alerts"
+ label="Push Protocol Alerts"
+ />
+
+ }
+ label="Discord"
/>
{
/>
)}
+ {selectedProtocols.includes('Discord') && (
+
+ handleDiscordWebhookChange(e)}
+ />
+
+ )}
+
{selectedProtocols.includes('Email') && (
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index 0d4f80d..0573051 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -6184,11 +6184,6 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
-fsevents@^2.3.2, fsevents@~2.3.2:
- version "2.3.3"
- resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
- integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
-
function-bind@^1.1.1, function-bind@^1.1.2:
version "1.1.2"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"