mirror of
https://github.com/vuejs/apollo.git
synced 2025-12-08 18:02:09 +00:00
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:
parent
64491ce1ca
commit
99c442bf27
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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;')
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user