Files
hoppscotch/layouts/default.vue
Liyas Thomas a724dc1207 proxy.hoppscotch.io (#1532)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2021-03-14 08:54:15 +05:30

70 lines
1.9 KiB
Vue

<template>
<div class="wrapper">
<div class="content">
<div class="columns">
<AppSidenav />
<main class="container">
<AppHeader />
<nuxt />
<AppFooter />
</main>
</div>
</div>
</div>
</template>
<script>
export default {
beforeMount() {
let color = localStorage.getItem("THEME_COLOR") || "green"
document.documentElement.setAttribute("data-accent", color)
},
async mounted() {
if (process.client) {
document.body.classList.add("afterLoad")
}
// Migrate old default proxy URL to the new proxy URL (if not set / overridden)
if (
this.$store.state.postwoman.settings.PROXY_URL &&
this.$store.state.postwoman.settings.PROXY_URL === "https://hoppscotch.apollosoftware.xyz/"
) {
this.$store.state.postwoman.settings.PROXY_URL = "https://proxy.hoppscotch.io/"
}
console.log(
"%cWe ❤︎ open source!",
"background-color:white;padding:8px 16px;border-radius:8px;font-size:32px;color:red;"
)
console.log(
"%cContribute: https://github.com/hoppscotch/hoppscotch",
"background-color:black;padding:4px 8px;border-radius:8px;font-size:16px;color:white;"
)
const workbox = await window.$workbox
if (workbox) {
workbox.addEventListener("installed", (event) => {
if (event.isUpdate) {
this.$toast.show(this.$t("new_version_found"), {
icon: "info",
duration: 0,
theme: "toasted-primary",
action: [
{
text: this.$t("reload"),
onClick: (e, toastObject) => {
toastObject.goAway(0)
this.$router.push("/", () => window.location.reload())
},
},
],
})
}
})
}
},
beforeDestroy() {
document.removeEventListener("keydown", this._keyListener)
},
}
</script>