@@ -39,6 +39,9 @@ _axios.interceptors.response.use(
}
)
+// with cookie
+_axios.defaults.withCredentials = true
+
Plugin.install = function (Vue, options) {
Vue.axios = _axios
window.axios = _axios
@@ -58,4 +61,4 @@ Plugin.install = function (Vue, options) {
Vue.use(Plugin)
-export default Plugin
+export default axios
@@ -2,7 +2,7 @@ import {
useCodeServer
} from '@/config/server-info'
import httpCode from '@/server/enums/http-code'
-import axios from '@/utils/axios'
+import axios from '@/plugins/axios'
export function sendEmailCode(email) {
return axios
@@ -1,7 +1,7 @@
import {
useCommentServer
export function createComment(slideId, pageNumber, title, content) {
useCourseServer
export function createCourse({ name, bio, code, cover }) {
useReplyServer
export function createReply({ commentId, content }) {
useSlideServer
export function createSlide({ courseId, name, file }) {
useUserServer
export function register({ name, email, emailCode, phone, phoneCode, password }) {
const data = {
@@ -1,5 +0,0 @@
-import axios from 'axios'
-
-axios.defaults.withCredentials = true
-export default axios