From aabf48fa7e4a87775e25389b24297fbaeaf33bd4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 1 Oct 2024 00:09:06 +0530 Subject: [PATCH] feat: use notify for alerts --- src/components/organisms/ProxyForm.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/ProxyForm.tsx b/src/components/organisms/ProxyForm.tsx index 450bfd71..db0fe310 100644 --- a/src/components/organisms/ProxyForm.tsx +++ b/src/components/organisms/ProxyForm.tsx @@ -2,6 +2,7 @@ import React, { useState } from 'react'; import { styled } from '@mui/system'; import { TextField, Button, RadioGroup, FormControlLabel, Radio, Box, Typography } from '@mui/material'; import { sendProxyConfig } from '../../api/proxy'; +import { useGlobalInfoStore } from '../../context/globalInfo'; const FormContainer = styled(Box)({ display: 'flex', @@ -23,6 +24,8 @@ const ProxyForm: React.FC = () => { password: '', }); + const { notify } = useGlobalInfoStore(); + const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target; setProxyConfig({ ...proxyConfig, [name]: value }); @@ -32,9 +35,9 @@ const ProxyForm: React.FC = () => { e.preventDefault(); await sendProxyConfig(proxyConfig).then((response) => { if (response) { - alert('Proxy configuration submitted successfully'); + notify('success','Proxy configuration submitted successfully'); } else { - alert('Failed to submit proxy configuration. Try again.'); + notify('error', 'Failed to submit proxy configuration. Try again.'); } }); };