Added parse for JSON before updating.

This commit is contained in:
Scott Idem
2024-11-12 16:58:20 -05:00
parent 34bcd9dd2d
commit 26e1c89f1b

View File

@@ -125,6 +125,16 @@ async function handle_submit_form(event) {
archive_do['original_url'] = archive_di.original_url;
archive_do['original_url_text'] = archive_di.original_url_text;
if (archive_di.cfg_json) {
try {
archive_do['cfg_json'] = JSON.parse(archive_di.cfg_json);
} catch (error) {
console.log('Error parsing JSON:', error);
}
} else {
// archive_do['cfg_json'] = {};
}
archive_do['hide'] = archive_di.hide;
archive_do['priority'] = archive_di.priority;
if (archive_di.sort) {
@@ -368,6 +378,15 @@ async function handle_submit_form(event) {
</div>
</fieldset> -->
{#if $ae_loc.administrator_access}
<textarea
name="cfg_json"
id="cfg_json"
class="textarea w-full font-mono text-sm"
rows={$idaa_slct.archive_obj.cfg_json?.length ?? 6}
>{JSON.stringify($idaa_slct.archive_obj.cfg_json, null, 2)}</textarea>
{/if}
{#if $ae_loc.trusted_access}
<button