import { createApp } from 'vue'
import App from './App.vue'

import router from "./router/router.js"
import { QuillEditor } from '@vueup/vue-quill'
import '@vueup/vue-quill/dist/vue-quill.snow.css';

import ElementPlus from 'element-plus';

import 'element-plus/dist/index.css'
import axios from 'axios'
import VueAxios from 'vue-axios'
import zhCn from 'element-plus/es/locale/lang/zh-cn'  
axios.defaults.baseURL='https://a99zg89a.xiaomy.net'



let app=createApp(App)
app.config.globalProperties.$bucketName = "nianhua-test"
app.use(router)
app.use(ElementPlus,{locale:zhCn});
app.use(VueAxios,axios)
app.mount('#app')
app.component('QuillEditor', QuillEditor)

axios.interceptors.request.use(config => {
    
  config.headers.Authorization = "Basic c2FiZXI6c2FiZXJfc2VjcmV0"

  if (config.url!="/hysc/auth/token") {
    if (!localStorage.token) {
      console.log(app);
   
      router.replace('/');
      return config    
    }
  }

  config.headers.common['Blade-Auth'] =localStorage.token


  return config
})