handle arrays

This commit is contained in:
2024-04-23 08:38:16 +10:00
parent f0d3e739f8
commit bdf8846278

View File

@@ -47,6 +47,7 @@
}
function updateFiles(result) {
Alpine.store('files', []);
// Check if result is a string or a collection
@@ -73,7 +74,14 @@
}
document.addEventListener('alpine:init', () => {
updateFiles('{{ $value }}'.split(',') || []);
const files = '{!! addslashes($value) !!}';
let fileData = [];
try {
fileData = JSON.parse(files);
} catch {
}
updateFiles(fileData);
});
</script>
@endif