Skip to content

Commit 7b337e3

Browse files
committed
Maintenance mode
1 parent e5415a8 commit 7b337e3

File tree

2 files changed

+55
-12
lines changed

2 files changed

+55
-12
lines changed

src/router.js

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
11
import Vue from 'vue'
22
import Router from 'vue-router'
33
import Index from './views/index.vue'
4-
import Error404 from './views/errors/404.vue'
4+
5+
import Error404 from './views/errors/error404.vue'
6+
import Maintenance from './views/errors/maintenance.vue'
57

68
Vue.use(Router)
79

8-
const router = new Router({
9-
mode: 'history',
10-
routes: [
11-
{
12-
path: '/',
13-
name: 'index',
14-
component: Index
15-
},
10+
/**
11+
* Routing
12+
*/
13+
let routes = [
14+
{
15+
path: '/',
16+
component: Index
17+
},
18+
{
19+
path: '*',
20+
component: Error404,
21+
}
22+
];
23+
24+
/**
25+
* Down for maintenance mode via .env
26+
*/
27+
if (process.env.VUE_APP_MAINTENANCE_MODE) {
28+
routes = [
1629
{
1730
path: '*',
18-
component: Error404,
19-
},
20-
]
31+
component: Maintenance,
32+
}
33+
];
34+
}
35+
36+
let router = new Router({
37+
mode: 'history',
38+
routes,
2139
})
2240
export default router

src/views/errors/maintenance.vue

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<template>
2+
<div>
3+
<div class="container px-4 pt-20 text-center">
4+
<h1 class="text-3xl md:text-6xl font-bold text-gray-200">
5+
Down for maintenance
6+
</h1>
7+
<p class="max-w-md mx-auto">
8+
Sorry, we're down for scheduled maintenance. Please&nbsp;check&nbsp;back&nbsp;soon.
9+
</p>
10+
</div>
11+
</div>
12+
</template>
13+
14+
<script>
15+
export default {
16+
name: 'Maintenance',
17+
components: {
18+
},
19+
metaInfo() {
20+
return {
21+
title: this.$siteName,
22+
};
23+
},
24+
}
25+
</script>

0 commit comments

Comments
 (0)