diff --git a/front/src/init/axios.ts b/front/src/init/axios.ts index 9c67daf68334973fd067ef2f918e4556c7aa3411..027f310413ffb18a485a9e80815a701021e49e11 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 bdf189f5e194f0e83148ce38bf03243c1580851b..7d692754a1b37ee900c861232bec958cce8d2d7b 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 db5e9266c73bab7afb8bf221bf030fdbea6ef33c..cebb1cbf205bcddc6667a4897de7e8a0ded910b7 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 135656a09a327f9703cf37c4a5ae365fd4fdaf8f..76142e9c19eabd1847629507246af60b27864250 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 0d9d188538891e5716f8d564e5f10c061e8cc249..8796849a24216e991a4248ab78c88c7e94dfd5d1 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 0a5a9e685615fe520673fc9f995f5a0c9fc46a50..31b1db7e1597e0c4aea488cd3eb18b88404bc486 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 <translate> tags // while preserving router behaviour -export const install: AppModule = ({ router }) => { +export const install: InitModule = ({ router }) => { document.documentElement.addEventListener('click', async (event) => { const target = <HTMLAnchorElement> event.target if (!target.matches('a.internal')) return diff --git a/front/src/init/locale.ts b/front/src/init/locale.ts index 86d32646b265ad8852754bc131aa750ae2e160cd..bc8ae6a08eac32efb79a8ee73dc6acc82ba5d160 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 f3eba154c9d84ec3c7b2ad9fc9f838be3a14c559..0d8434272510a084dc7c00614457a053419c8b71 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 63f9bdfedd851a7463416533c9152e509195adf0..f683bea7e689176585b69d7090f91ec8bb071780 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 cf44d4a6fbd8e036922bc544964d05983d22c229..4664367e5933b43e9763c3b302644b4412bdc216 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