mirror of https://github.com/halo-dev/halo
perf: remove nprogress.
parent
3531d58ac7
commit
1f80452b10
File diff suppressed because it is too large
Load Diff
|
@ -18,7 +18,6 @@
|
|||
"halo-editor": "^2.7.9",
|
||||
"marked": "^0.7.0",
|
||||
"moment": "^2.24.0",
|
||||
"nprogress": "^0.2.0",
|
||||
"verte": "^0.0.12",
|
||||
"vue": "^2.6.10",
|
||||
"vue-clipboard2": "^0.3.0",
|
||||
|
|
|
@ -7,8 +7,7 @@ const adminApi = {}
|
|||
adminApi.counts = () => {
|
||||
return service({
|
||||
url: `${baseUrl}/counts`,
|
||||
method: 'get',
|
||||
mute: true
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ postApi.create = (postToCreate, autoSave) => {
|
|||
url: baseUrl,
|
||||
method: 'post',
|
||||
data: postToCreate,
|
||||
mute: autoSave,
|
||||
params: {
|
||||
autoSave: autoSave
|
||||
}
|
||||
|
|
|
@ -6,17 +6,9 @@ import {
|
|||
domTitle
|
||||
} from '@/utils/domUtil'
|
||||
|
||||
import NProgress from 'nprogress' // progress bar
|
||||
import 'nprogress/nprogress.css' // progress bar style
|
||||
|
||||
NProgress.configure({
|
||||
showSpinner: false
|
||||
}) // NProgress Configuration
|
||||
|
||||
const whiteList = ['Login', 'Install', 'NotFound', 'ResetPassword'] // no redirect whitelist
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
to.meta && (typeof to.meta.title !== 'undefined' && setDocumentTitle(`${to.meta.title} - ${domTitle}`))
|
||||
Vue.$log.debug('Token', store.getters.token)
|
||||
if (store.getters.token) {
|
||||
|
@ -24,7 +16,6 @@ router.beforeEach((to, from, next) => {
|
|||
next({
|
||||
name: 'Dashboard'
|
||||
})
|
||||
NProgress.done()
|
||||
return
|
||||
}
|
||||
// TODO Get installation status
|
||||
|
@ -34,7 +25,6 @@ router.beforeEach((to, from, next) => {
|
|||
}
|
||||
|
||||
next()
|
||||
NProgress.done()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -42,7 +32,6 @@ router.beforeEach((to, from, next) => {
|
|||
// Check whitelist
|
||||
if (whiteList.includes(to.name)) {
|
||||
next()
|
||||
NProgress.done()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -52,5 +41,4 @@ router.beforeEach((to, from, next) => {
|
|||
redirect: to.fullPath
|
||||
}
|
||||
})
|
||||
NProgress.done()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import axios from 'axios'
|
||||
import NProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
import Vue from 'vue'
|
||||
import { message, notification } from 'ant-design-vue'
|
||||
import store from '@/store'
|
||||
|
@ -63,27 +61,20 @@ function getFieldValidationError(data) {
|
|||
service.interceptors.request.use(
|
||||
config => {
|
||||
config.baseURL = store.getters.apiUrl
|
||||
if (!config.mute) {
|
||||
NProgress.start()
|
||||
}
|
||||
// TODO set token
|
||||
setTokenToHeader(config)
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
NProgress.remove()
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
NProgress.done()
|
||||
return response
|
||||
},
|
||||
error => {
|
||||
NProgress.done()
|
||||
|
||||
if (axios.isCancel(error)) {
|
||||
Vue.$log.debug('Cancelled uploading by user.')
|
||||
return Promise.reject(error)
|
||||
|
|
Loading…
Reference in New Issue