diff --git a/front/src/init/axios.ts b/front/src/init/axios.ts index 9c67daf68..027f31041 100644 --- a/front/src/init/axios.ts +++ b/front/src/init/axios.ts @@ -1,4 +1,4 @@ -import { AppModule } from '~/types' +import { InitModule } from '~/types' import createAuthRefreshInterceptor from 'axios-auth-refresh' import axios, { AxiosError } from 'axios' @@ -7,7 +7,7 @@ import logger from '~/logging' import { parseAPIErrors } from '~/utils' import Vue from 'vue' -export const install: AppModule = ({ app, store, router }) => { +export const install: InitModule = ({ app, store, router }) => { axios.defaults.xsrfCookieName = 'csrftoken' axios.defaults.xsrfHeaderName = 'X-CSRFToken' axios.interceptors.request.use(function (config) { diff --git a/front/src/init/directives.ts b/front/src/init/directives.ts index bdf189f5e..7d692754a 100644 --- a/front/src/init/directives.ts +++ b/front/src/init/directives.ts @@ -1,7 +1,7 @@ -import { AppModule } from '~/types' +import { InitModule } from '~/types' import jQuery from '~/jquery' -export const install: AppModule = ({ app, store }) => { +export const install: InitModule = ({ app, store }) => { app.directive('title', function (el, binding) { store.commit('ui/pageTitle', binding.value) }) diff --git a/front/src/init/filters.ts b/front/src/init/filters.ts index db5e9266c..cebb1cbf2 100644 --- a/front/src/init/filters.ts +++ b/front/src/init/filters.ts @@ -1,4 +1,4 @@ -import { AppModule } from '~/types' +import { InitModule } from '~/types' import Vue from 'vue' import time from '~/utils/time' @@ -123,7 +123,7 @@ export function unique (list: { [key: string]: unknown }[], property: string) { return unique } -export const install: AppModule = () => { +export const install: InitModule = () => { Vue.filter('humanSize', humanSize) Vue.filter('unique', unique) Vue.filter('capitalize', capitalize) diff --git a/front/src/init/globalComponents.ts b/front/src/init/globalComponents.ts index 135656a09..76142e9c1 100644 --- a/front/src/init/globalComponents.ts +++ b/front/src/init/globalComponents.ts @@ -1,4 +1,4 @@ -import { AppModule } from '~/types' +import { InitModule } from '~/types' import HumanDate from '~/components/common/HumanDate.vue' import HumanDuration from '~/components/common/HumanDuration.vue' @@ -20,7 +20,7 @@ import RenderedDescription from '~/components/common/RenderedDescription.vue' import ContentForm from '~/components/common/ContentForm.vue' import InlineSearchBar from '~/components/common/InlineSearchBar.vue' -export const install: AppModule = ({ app }) => { +export const install: InitModule = ({ app }) => { app.component('HumanDate', HumanDate) app.component('HumanDuration', HumanDuration) app.component('Username', Username) diff --git a/front/src/init/instance.ts b/front/src/init/instance.ts index 0d9d18853..8796849a2 100644 --- a/front/src/init/instance.ts +++ b/front/src/init/instance.ts @@ -1,8 +1,8 @@ -import { AppModule } from '~/types' +import { InitModule } from '~/types' import { watch } from '@vue/composition-api' import axios from 'axios' -export const install: AppModule = async ({ store, router }) => { +export const install: InitModule = async ({ store, router }) => { watch(() => store.state.instance.instanceUrl, async () => { const [{ data }] = await Promise.all([ axios.get('instance/nodeinfo/2.0/'), diff --git a/front/src/init/internalLinks.ts b/front/src/init/internalLinks.ts index 0a5a9e685..31b1db7e1 100644 --- a/front/src/init/internalLinks.ts +++ b/front/src/init/internalLinks.ts @@ -1,8 +1,8 @@ -import { AppModule } from '~/types' +import { InitModule } from '~/types' // slight hack to allow use to have internal links in tags // while preserving router behaviour -export const install: AppModule = ({ router }) => { +export const install: InitModule = ({ router }) => { document.documentElement.addEventListener('click', async (event) => { const target = event.target if (!target.matches('a.internal')) return diff --git a/front/src/init/locale.ts b/front/src/init/locale.ts index 86d32646b..bc8ae6a08 100644 --- a/front/src/init/locale.ts +++ b/front/src/init/locale.ts @@ -3,9 +3,9 @@ import GetText from 'vue-gettext' import locales from '~/locales.json' import { usePreferredLanguages } from '@vueuse/core' import { watch } from '@vue/composition-api' -import { AppModule } from '~/types' +import { InitModule } from '~/types' -export const install: AppModule = ({ store, app }) => { +export const install: InitModule = ({ store, app }) => { const defaultLanguage = store.state.ui.currentLanguage ?? 'en_US' const availableLanguages = locales.reduce((map: { [key: string]: string }, locale) => { map[locale.code] = locale.label diff --git a/front/src/init/serviceWorker.ts b/front/src/init/serviceWorker.ts index f3eba154c..0d8434272 100644 --- a/front/src/init/serviceWorker.ts +++ b/front/src/init/serviceWorker.ts @@ -1,7 +1,7 @@ -import { AppModule } from '~/types' +import { InitModule } from '~/types' import { register } from 'register-service-worker' -export const install: AppModule = ({ store }) => { +export const install: InitModule = ({ store }) => { if (import.meta.env.PROD) { register(`${import.meta.env.BASE_URL}service-worker.js`, { registrationOptions: { scope: '/' }, diff --git a/front/src/init/webSocket.ts b/front/src/init/webSocket.ts index 63f9bdfed..f683bea7e 100644 --- a/front/src/init/webSocket.ts +++ b/front/src/init/webSocket.ts @@ -1,8 +1,8 @@ -import { AppModule } from '~/types' +import { InitModule } from '~/types' import { watchEffect, watch } from '@vue/composition-api' import { useWebSocket, whenever } from '@vueuse/core' -export const install: AppModule = ({ store }) => { +export const install: InitModule = ({ store }) => { watch(() => store.state.instance.instanceUrl, () => { const url = store.getters['instance/absoluteUrl']('api/v1/activity') .replace(/^http/, 'ws') diff --git a/front/src/init/window.ts b/front/src/init/window.ts index cf44d4a6f..4664367e5 100644 --- a/front/src/init/window.ts +++ b/front/src/init/window.ts @@ -1,8 +1,8 @@ -import { AppModule } from '~/types' +import { InitModule } from '~/types' import { useWindowSize } from '@vueuse/core' import { watchEffect } from '@vue/composition-api' -export const install: AppModule = ({ store }) => { +export const install: InitModule = ({ store }) => { // NOTE: Due to Vuex 3, when using store in watchEffect, it results in an infinite loop after committing const { commit } = store