🏗 Added error check state

This commit is contained in:
2023-11-04 23:44:25 -04:00
parent c3b9ad9d91
commit 1f8dded15e
2 changed files with 26 additions and 18 deletions

View File

@@ -47,25 +47,27 @@ export const QbittorrentConnectionForm = (): ReactElement => {
}), }),
}); });
return ( if (isError)
<> return (
{!isLoading ? ( <>
<> <pre>Something went wrong connecting to qBittorrent.</pre>
<ConnectionForm </>
initialData={hostDetails} );
formHeading={"qBittorrent Configuration"} if (!isLoading) {
submitHandler={mutate} return (
/> <>
<ConnectionForm
initialData={hostDetails}
formHeading={"qBittorrent Configuration"}
submitHandler={mutate}
/>
<pre className="mt-5"> <pre className="mt-5">
{JSON.stringify(qbittorrentClientInfo?.data, null, 4)} {JSON.stringify(qbittorrentClientInfo?.data, null, 4)}
</pre> </pre>
</> </>
) : ( );
"Loading..." }
)}
</>
);
}; };
export default QbittorrentConnectionForm; export default QbittorrentConnectionForm;

View File

@@ -93,6 +93,12 @@ export const ConnectionForm = ({
{!isEmpty(initialData) ? "Update" : "Save"} {!isEmpty(initialData) ? "Update" : "Save"}
</button> </button>
</p> </p>
<p className="control">
<button type="submit" className="button is-danger">
{!isEmpty(initialData) && "Delete"}
</button>
</p>
</div> </div>
</form> </form>
)} )}