11 lines
No EOL
307 B
JavaScript
11 lines
No EOL
307 B
JavaScript
const readJson = (filePath) => {
|
|
return fetch(filePath)
|
|
.then(response => {
|
|
if(!response.ok) {
|
|
throw new Error(`Erreur lors du chargement du fichier JSON : ${response.statusText}`);
|
|
}
|
|
return response.json();
|
|
})
|
|
};
|
|
|
|
export { readJson }; |