Skip to content
Snippets Groups Projects
Commit 82025ada authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Type the main module

parent 3953b73e
No related branches found
No related tags found
1 merge request!1375Type the main module
......@@ -50,6 +50,7 @@ axios.interceptors.response.use(response => {
if (responseType.startsWith('text/html') && typeof response.data === 'string') {
const err = new Error('Not found.')
// @ts-expect-error Upgrade to Axios 1.x required to work with Axios errors properly
err.response = response
return Promise.reject(err)
}
......@@ -71,7 +72,7 @@ axios.interceptors.response.use(response => {
) return Promise.reject(error)
// Get the request path, without the host
let path = null
let path: string | null = null
try {
path = error.request ? new URL(error.request.responseURL).pathname : null
} catch (e) {
......@@ -80,7 +81,7 @@ axios.interceptors.response.use(response => {
// Remove UUIDs to get the original API endpoint paths
if (path) path = path.replace(new RegExp(UUID), '<uuid>')
let fingerprint = []
let fingerprint: string[] = []
if (error.response) {
/*
* Error with a response from the backend
......@@ -95,7 +96,7 @@ axios.interceptors.response.use(response => {
]
} else if (error.request) {
// Error without any response
fingerprint = ['axios-error-request', path]
fingerprint = ['axios-error-request', path ?? '']
} else {
// Error occurring before sending the request
fingerprint = ['axios-error-setup', error]
......
......@@ -12,10 +12,6 @@ process.env.VUE_APP_VERSION = process.env.NODE_ENV === 'development' ? `${versio
module.exports = defineConfig({
lintOnSave: false,
chainWebpack: config => {
// We have enabled TypeScript, but we do not have a src/main.ts yet, so we have to override the entrypoint Vue defines
config.entry('app').clear()
config.entry('app').add('./src/main.js')
config
.plugin('lodash')
.use(LodashModuleReplacementPlugin, [{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment