This commit is contained in:
firestar5683
2026-08-02 20:53:49 -05:00
parent 6dd4d74ca0
commit ac56cce888
2 changed files with 7 additions and 1 deletions
@@ -541,7 +541,11 @@ async function revertProfile() {
state.runningAction = true
try {
const response = await fetch("/api/flm/trials/revert", { method: "POST" })
const payload = await response.json()
const body = await response.text()
let payload
try { payload = body ? JSON.parse(body) : {} } catch (_) {
payload = { error: body.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim() }
}
if (!response.ok) throw new Error(payload.error || "Failed to revert trial profile.")
state.error = ""
await fetchWorkspace()
@@ -6093,6 +6093,8 @@ def setup(app):
result = flm_workspace.revert_trial_profile()
except FileNotFoundError:
return jsonify({"error": "No active FLM trial snapshot was found."}), 404
except Exception as error:
return jsonify({"error": f"{type(error).__name__}: {error}"}), 500
return jsonify(result), 200