refactor: replace deprecated String.prototype.substr() (#1335)

.substr() is deprecated so we replace it with .slice() or .substring() which work similarily but aren't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
CommanderRoot
2022-05-03 10:43:55 +02:00
committed by GitHub
parent 64491ce1ca
commit 99c442bf27
5 changed files with 5 additions and 5 deletions
@@ -5,7 +5,7 @@ import { createApp } from './main'
const prepareUrlForRouting = url => {
const { BASE_URL } = process.env
return url.startsWith(BASE_URL.replace(/\/$/, ''))
? url.substr(BASE_URL.length)
? url.slice(BASE_URL.length)
: url
}
@@ -7,7 +7,7 @@ const AUTH_TOKEN = 'apollo-token'
// Http endpoint
const httpEndpoint = process.env.VUE_APP_GRAPHQL_HTTP || 'http://localhost:4042/graphql'
// Files URL root
export const filesRoot = process.env.VUE_APP_FILES_ROOT || httpEndpoint.substr(0, httpEndpoint.indexOf('/graphql'))
export const filesRoot = process.env.VUE_APP_FILES_ROOT || httpEndpoint.substring(0, httpEndpoint.indexOf('/graphql'))
Vue.prototype.$filesRoot = filesRoot
+1 -1
View File
@@ -5,7 +5,7 @@ import { createApp } from './main'
const prepareUrlForRouting = url => {
const { BASE_URL } = process.env
return url.startsWith(BASE_URL.replace(/\/$/, ''))
? url.substr(BASE_URL.length)
? url.slice(BASE_URL.length)
: url
}
+1 -1
View File
@@ -13,7 +13,7 @@ const AUTH_TOKEN = 'apollo-token'
// Http endpoint
const httpEndpoint = process.env.VUE_APP_GRAPHQL_HTTP || 'http://localhost:4042/graphql'
// Files URL root
export const filesRoot = process.env.VUE_APP_FILES_ROOT || httpEndpoint.substr(0, httpEndpoint.indexOf('/graphql'))
export const filesRoot = process.env.VUE_APP_FILES_ROOT || httpEndpoint.substring(0, httpEndpoint.indexOf('/graphql'))
Vue.prototype.$filesRoot = filesRoot
+1 -1
View File
@@ -48,7 +48,7 @@ export function logErrorMessages (error: ApolloError | ErrorResponse, printStack
if (stack == null) return
const newLineIndex = stack.indexOf('\n')
stack = stack.substr(stack.indexOf('\n', newLineIndex + 1))
stack = stack.slice(stack.indexOf('\n', newLineIndex + 1))
console.log(`%c${stack}`, 'color:grey;')
}
}