🏗 Added error check state
This commit is contained in:
@@ -47,25 +47,27 @@ export const QbittorrentConnectionForm = (): ReactElement => {
|
||||
}),
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
{!isLoading ? (
|
||||
<>
|
||||
<ConnectionForm
|
||||
initialData={hostDetails}
|
||||
formHeading={"qBittorrent Configuration"}
|
||||
submitHandler={mutate}
|
||||
/>
|
||||
if (isError)
|
||||
return (
|
||||
<>
|
||||
<pre>Something went wrong connecting to qBittorrent.</pre>
|
||||
</>
|
||||
);
|
||||
if (!isLoading) {
|
||||
return (
|
||||
<>
|
||||
<ConnectionForm
|
||||
initialData={hostDetails}
|
||||
formHeading={"qBittorrent Configuration"}
|
||||
submitHandler={mutate}
|
||||
/>
|
||||
|
||||
<pre className="mt-5">
|
||||
{JSON.stringify(qbittorrentClientInfo?.data, null, 4)}
|
||||
</pre>
|
||||
</>
|
||||
) : (
|
||||
"Loading..."
|
||||
)}
|
||||
</>
|
||||
);
|
||||
<pre className="mt-5">
|
||||
{JSON.stringify(qbittorrentClientInfo?.data, null, 4)}
|
||||
</pre>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default QbittorrentConnectionForm;
|
||||
|
||||
@@ -93,6 +93,12 @@ export const ConnectionForm = ({
|
||||
{!isEmpty(initialData) ? "Update" : "Save"}
|
||||
</button>
|
||||
</p>
|
||||
|
||||
<p className="control">
|
||||
<button type="submit" className="button is-danger">
|
||||
{!isEmpty(initialData) && "Delete"}
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user