Skip to content

Commit

Permalink
save webhook settings
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyYe committed Feb 24, 2024
1 parent 2bc2a70 commit b383e71
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions web/app/network/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { CommonContext } from "@/components/user";
import { useEffect, useState, useContext } from "react";
import { get_network_settings, NetworkSettings, update_network_settings } from "@/api/network";
import { get_info } from "@/api/info";
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

export default function Network() {
const router = useRouter();
Expand All @@ -35,6 +37,7 @@ export default function Network() {

return (
<main className="flex min-h-screen flex-col items-center justify-between pt-10 max-w-screen-xl">
<ToastContainer />
<div className="p-5">
<div className="flex flex-col max-w-screen-lg gap-5">
<IpMode
Expand Down Expand Up @@ -102,9 +105,22 @@ export default function Network() {
<div className="flex justify-center">
<button className="flex btn btn-primary"
onClick={() => {
console.log('settings', settings);
if (!credentials) {
toast.error('Invalid credentials');
return;
}

update_network_settings(credentials, settings).then((success) => {
if (success) {
toast.success('Network settings updated successfully');
} else {
toast.error('Failed to update network settings');
}
});
}}
>Save</button>
>
Save
</button>
</div>
</div>
</div>
Expand Down

0 comments on commit b383e71

Please sign in to comment.