fix: no irc network created when adding a new indexer (#177)

This commit is contained in:
Ludvig Lundgren 2022-03-16 20:39:48 +01:00 committed by GitHub
parent aa196d8104
commit 8bf43dc1e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 27 deletions

View file

@ -89,7 +89,7 @@ export const APIClient = {
},
irc: {
getNetworks: () => appClient.Get<IrcNetworkWithHealth[]>("api/irc"),
createNetwork: (network: IrcNetwork) => appClient.Post("api/irc", network),
createNetwork: (network: IrcNetworkCreate) => appClient.Post("api/irc", network),
updateNetwork: (network: IrcNetwork) => appClient.Put(`api/irc/network/${network.id}`, network),
deleteNetwork: (id: number) => appClient.Delete(`api/irc/network/${id}`),
},

View file

@ -148,7 +148,7 @@ export function IndexerAddForm({ isOpen, toggle }: AddProps) {
})
const ircMutation = useMutation(
(network: IrcNetwork) => APIClient.irc.createNetwork(network)
(network: IrcNetworkCreate) => APIClient.irc.createNetwork(network)
);
const onSubmit = (formData: any) => {
@ -170,13 +170,11 @@ export function IndexerAddForm({ isOpen, toggle }: AddProps) {
});
}
const network: IrcNetwork = {
id: 0,
const network: IrcNetworkCreate = {
name: ind.irc.network,
pass: "",
enabled: false,
connected: false,
connected_since: 0,
server: ind.irc.server,
port: ind.irc.port,
tls: ind.irc.tls,

View file

@ -13,6 +13,19 @@ interface IrcNetwork {
connected_since: Time;
}
interface IrcNetworkCreate {
name: string;
enabled: boolean;
server: string;
port: number;
tls: boolean;
pass: string;
invite_command: string;
nickserv?: NickServ; // optional
channels: IrcChannel[];
connected: boolean;
}
interface IrcChannel {
id: number;
enabled: boolean;