Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -24,6 +24,7 @@ export default function LicenseManager() {
|
||||
const [verifying, setVerifying] = useState(false);
|
||||
const [verifyKey, setVerifyKey] = useState("");
|
||||
const [verifyHostname, setVerifyHostname] = useState("");
|
||||
const [verifyVersion, setVerifyVersion] = useState("");
|
||||
const [newUserForm, setNewUserForm] = useState({
|
||||
username: "",
|
||||
name: "",
|
||||
@@ -268,7 +269,8 @@ export default function LicenseManager() {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
key: verifyKey.trim(),
|
||||
hostname: verifyHostname.trim()
|
||||
hostname: verifyHostname.trim(),
|
||||
currentVersion: verifyVersion.trim() || undefined
|
||||
})
|
||||
});
|
||||
const data = await response.json().catch(() => ({}));
|
||||
@@ -440,6 +442,14 @@ export default function LicenseManager() {
|
||||
placeholder="voorbeeld.nl"
|
||||
/>
|
||||
</label>
|
||||
<label className="field">
|
||||
<span>Deze site draait versie</span>
|
||||
<input
|
||||
value={verifyVersion}
|
||||
onChange={(event) => setVerifyVersion(event.target.value)}
|
||||
placeholder="bijv. 1.9.3"
|
||||
/>
|
||||
</label>
|
||||
<button className="ghost" type="submit" disabled={verifying}>
|
||||
{verifying ? "Controleren…" : "Controleer licentie"}
|
||||
</button>
|
||||
@@ -447,11 +457,22 @@ export default function LicenseManager() {
|
||||
{verifyStatus && verifyStatus.ok && verifyStatus.data?.license && (
|
||||
<div className="state success inline">
|
||||
<strong>Licentie geldig</strong>
|
||||
<p>{verifyStatus.data.license.pluginName || "Plugin"}</p>
|
||||
<p>
|
||||
{verifyStatus.data.license.pluginName || "Plugin"} — versie {verifyStatus.data.license.pluginVersion || "-"}
|
||||
Huidige versie:{" "}
|
||||
<strong>
|
||||
{verifyStatus.data.license.lastUsedVersion ||
|
||||
verifyStatus.data.license.pluginVersion ||
|
||||
"-"}
|
||||
</strong>
|
||||
</p>
|
||||
<p>
|
||||
Gekoppeld aan: <strong>{verifyStatus.data.license.primaryHostname || "Nog niet gekoppeld"}</strong>
|
||||
Laatste release:{" "}
|
||||
<strong>{verifyStatus.data.license.pluginVersion || "-"}</strong>
|
||||
</p>
|
||||
<p>
|
||||
Gekoppeld aan:{" "}
|
||||
<strong>{verifyStatus.data.license.primaryHostname || "Nog niet gekoppeld"}</strong>
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user