add temporary error message for soon to be deprecated event api
This commit is contained in:
2 files changed
+15
No files matched your search
@@ -56,6 +56,17 @@ const EventList = () => {
|
||||
</View>
|
||||
);
|
||||
|
||||
// TODO: temporary. Remove this once the new website is up
|
||||
if (error && error.message === 'I am a teapot') {
|
||||
return (
|
||||
<View style={theme.card}>
|
||||
<Text style={styles.loadingText}>
|
||||
Vi lager ny nettside! Programmet vil derfor være utilgjengelig inntil alt er på plass!
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<View style={theme.card}>
|
||||
|
||||
@@ -65,6 +65,10 @@ const useEventList = () => {
|
||||
let eventData;
|
||||
try {
|
||||
const res = await fetchWithTimeout(url);
|
||||
if (res.status == 418) {
|
||||
// TODO: temporary. Remove once new website is up and running
|
||||
throw new Error('I am a teapot');
|
||||
}
|
||||
setTotalPages(parseInt(res.headers.get('x-wp-totalpages') || '0', 10));
|
||||
eventData = await res.json();
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user