api-client/layouts/default.vue

77 lines
1.9 KiB
Vue
Raw Normal View History

2019-08-24 03:06:57 +00:00
<template>
2019-11-01 11:15:53 +00:00
<div class="wrapper">
<div class="content">
<div class="columns">
<AppSidenav />
<main>
<AppHeader />
<nuxt class="container" />
<AppFooter />
2020-09-24 17:22:17 +00:00
</main>
2019-11-01 11:15:53 +00:00
</div>
</div>
2019-09-02 04:48:01 +00:00
</div>
2019-08-24 03:06:57 +00:00
</template>
2019-10-25 08:14:34 +00:00
2019-09-02 04:48:01 +00:00
<script>
2021-06-21 04:27:45 +00:00
import {
setupLocalPersistence,
getLocalConfig,
} from "~/newstore/localpersistence"
import { performMigrations } from "~/helpers/migrations"
2021-05-14 00:16:10 +00:00
import { initUserInfo } from "~/helpers/teams/BackendUserInfo"
import { registerApolloAuthUpdate } from "~/helpers/apollo"
2021-06-14 04:07:30 +00:00
import { initializeFirebase } from "~/helpers/fb"
2019-11-12 04:18:57 +00:00
export default {
beforeMount() {
registerApolloAuthUpdate()
2021-06-21 04:27:45 +00:00
const color = getLocalConfig("THEME_COLOR") || "green"
2020-09-24 02:52:54 +00:00
document.documentElement.setAttribute("data-accent", color)
2019-11-12 04:18:57 +00:00
},
async mounted() {
performMigrations()
console.log(
"%cWe ❤︎ open source!",
"background-color:white;padding:8px 16px;border-radius:8px;font-size:32px;color:red;"
2020-02-24 18:44:50 +00:00
)
console.log(
2020-08-13 11:20:02 +00:00
"%cContribute: https://github.com/hoppscotch/hoppscotch",
"background-color:black;padding:4px 8px;border-radius:8px;font-size:16px;color:white;"
2020-02-24 18:44:50 +00:00
)
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"),
2021-05-18 06:26:59 +00:00
onClick: (_, toastObject) => {
toastObject.goAway(0)
2021-05-18 16:09:55 +00:00
window.location.reload()
},
},
],
})
}
})
}
setupLocalPersistence()
2021-05-14 00:16:10 +00:00
2021-06-14 04:07:30 +00:00
initializeFirebase()
2021-05-14 00:16:10 +00:00
initUserInfo()
2019-11-12 04:18:57 +00:00
},
beforeDestroy() {
document.removeEventListener("keydown", this._keyListener)
2020-02-24 18:44:50 +00:00
},
}
2019-08-24 03:06:57 +00:00
</script>