summaryrefslogtreecommitdiff
path: root/client/src/functions.js
blob: 7f06c3b90caced13b4dece61b44bcca2a5896e25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Dynamic article displaying
export async function fetchAttractions() {

    try {

        const response = await fetch("api/attractions");

        if (!response.ok) {
            const message = `An error has occured: ${response.status}`;
            throw new Error(message);
        }

        const attractions = response.json();
        return attractions;

    } catch(error) {
        console.log("something went wrong when fetching attractions: ", error);
    }

}