mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Use fetch for relative path
This commit is contained in:
parent
a45eaeb193
commit
52af193caa
@ -12,8 +12,6 @@ import { FileChooser, FilePickerAcceptType } from './FileChooser';
|
|||||||
|
|
||||||
import styles from './css/FileModal.module.css';
|
import styles from './css/FileModal.module.css';
|
||||||
|
|
||||||
const indexJSON = import('json/disks/index.json');
|
|
||||||
|
|
||||||
const DISK_TYPES: FilePickerAcceptType[] = [
|
const DISK_TYPES: FilePickerAcceptType[] = [
|
||||||
{
|
{
|
||||||
description: 'Disk Images',
|
description: 'Disk Images',
|
||||||
@ -52,8 +50,15 @@ export const FileModal = ({ disk2, number, onClose, isOpen }: FileModalProps) =>
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
spawn(async () => {
|
spawn(async () => {
|
||||||
const index = (await indexJSON).default;
|
try {
|
||||||
|
const indexRequest = fetch('/json/disks/index.json');
|
||||||
|
const indexResponse = await indexRequest;
|
||||||
|
const index = await indexResponse.json() as IndexEntry[];
|
||||||
setIndex(index);
|
setIndex(index);
|
||||||
|
} catch (error) {
|
||||||
|
setIndex([]);
|
||||||
|
setError(error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user