feat: handle spa errors with default loading indicator

This commit is contained in:
Pooya Parsa 2018-03-25 23:35:51 +04:30
parent a56c208f9b
commit b61698f44c

View File

@ -8,6 +8,7 @@ body, html, #__nuxt {
align-items: center;
margin: 0;
padding: 0;
flex-direction: column;
}
.loader,
@ -31,6 +32,11 @@ body, html, #__nuxt {
animation: load8 1.1s infinite linear;
}
.loader.error {
border-left: .5rem solid #ff4500;
animation-duration: 5s;
}
@-webkit-keyframes load8 {
0% {
-webkit-transform: rotate(0deg);
@ -54,6 +60,13 @@ body, html, #__nuxt {
}
</style>
<script>
window.addEventListener('error', function() {
var e = document.getElementById("loader");
if (e) e.className += " error";
});
</script>
<div class="loader"><%= options.loading %></div>
<%= options.dev ? '<!-- https://projects.lukehaas.me/css-loaders -->' : '' %>