优化图片上传,加入图床同步功能

This commit is contained in:
Elune
2019-12-20 19:30:06 +08:00
parent b9b48e139b
commit 4ccb6cb81c
8 changed files with 353 additions and 166 deletions

11
src/utils/upload.js Normal file
View File

@@ -0,0 +1,11 @@
import axios from 'axios'
import { getToken } from '@/utils/auth'
export function upload(api, file) {
var data = new FormData()
data.append('file', file)
const config = {
headers: { 'Authorization': getToken() }
}
return axios.post(api, data, config)
}