Skip to content

Commit

Permalink
Only send domainName (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
Janaka-Steph authored Oct 10, 2023
1 parent 34b7711 commit 9f7cd40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 41 deletions.
1 change: 1 addition & 0 deletions src/modules/settings/components/domain/Domains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const Domains = () => {
setDomains(dnsInfo.data.map((dnsInfo: { domain: any }) => dnsInfo.domain));
})();
}, []);

return (
<>
<div className="flex items-baseline mt-10 mb-4">
Expand Down
42 changes: 1 addition & 41 deletions src/modules/settings/components/domain/ManualDomainModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,11 @@ const ManualDomainModal = ({
setIsManualDomainModalOpen,
}: ManualDomainModalProps) => {
const [domainName, setDomainName] = useState("");
const [serverIP, setServerIP] = useState("");
const [email, setEmail] = useState("");
const [nodeName, setNodeName] = useState("");

const onSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
try {
await apiDnsd().post("dns", {
ip: serverIP,
domain: domainName,
email: email,
node_name: nodeName,
});
await apiDnsd().post("dns", { domain: domainName });
toast.success(
`Domain added successfully. You can now access Prem App at https://${domainName}`,
);
Expand All @@ -47,18 +39,6 @@ const ManualDomainModal = ({
setDomainName(e.target.value);
};

const onServerIPChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setServerIP(e.target.value);
};

const onEmailChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setEmail(e.target.value);
};

const onNodeNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setNodeName(e.target.value);
};

return (
<Modal className="modal" isOpen={isOpen}>
<div className="modal__content gradient-border w-4/5">
Expand All @@ -77,26 +57,6 @@ const ManualDomainModal = ({
onChange={onDomainNameChange}
placeholder="Enter your domain name"
/>
<input
className="form-control"
value={serverIP}
onChange={onServerIPChange}
placeholder="Enter your server IP"
/>
</div>
<div className="flex max-md:flex-col gap-8 md:gap-4 items-center">
<input
className="form-control"
value={email}
onChange={onEmailChange}
placeholder="Enter your email"
/>
<input
className="form-control"
value={nodeName}
onChange={onNodeNameChange}
placeholder="Enter your node name"
/>
</div>
<div className="flex justify-end mt-6">
<button type="submit" className="btn-primary">
Expand Down

0 comments on commit 9f7cd40

Please sign in to comment.