-
Notifications
You must be signed in to change notification settings - Fork 3
/
update.html
66 lines (58 loc) · 2.26 KB
/
update.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>White Flag Project</title>
<meta name="description" content="This is the homepage for The White Flag Project, which aims to
provide enriched data and regular updates on food banks and other resources
across Malaysia.">
<link rel="icon" href="favicon.ico">
<!--Open Graph metadata-->
<meta property="og:title" content="Homepage - White Flag Project">
<meta property="og:description" content="This is the homepage for The White Flag Project, which aims to
provide enriched data and regular updates on food banks and other resources
across Malaysia.">
<meta property="og:image" content="static/images/white flag logo.svg">
<meta property="og:type" content="website">
<script>
const id = new URLSearchParams(window.location.search).get('id')
const fetchData = async (url, params = {}) => {
const urlobj = new URL(url)
urlobj.search = new URLSearchParams(params).toString()
const response = await fetch(urlobj)
const result = await response.json()
return result
}
const replaceLink = (response = null) => {
if (response?.data?.UpdateForms) {
link = response?.data?.UpdateForms
const el = document.getElementById('embed-container')
el.setAttribute('data', link)
}
}
if (id) {
let datasource = null
fetchData(`https://y9g3chd0rj.execute-api.ap-southeast-1.amazonaws.com/production/query/${id}`)
.then(data => replaceLink(data))
.catch(e => {
alert(e.message)
window.location.replace('/')
})
} else {
window.location.replace('/')
}
</script>
<style>
html,
body {
margin: 0;
box-sizing: border-box;
}
</style>
</head>
<body>
<div style="width: 100%; height: 100vh; overflow-y: clip;">
<object style="width: 100%; height: 100%;" id="embed-container"></object>
</div>
</body>