import {getToken} from '@/libs/auth.js';
import config from "@/config/index.js"
const baseUrl = process.env.NODE_ENV === 'development' ? config.uploadFile.dev : config.uploadFile.pro;	
export const uploadApi=({formData,filePath,callback})=>{
	return new Promise(function(resolve,reject){
		const uploadTask=uni.uploadFile({
			url: baseUrl+'/uploadvedio/file/',
			filePath,
			name: 'vedioFile',
			// header:{
			// 	[config.TokenKey]:getToken()
			// },
			formData,
			success: (uploadFileRes) => {
				resolve(uploadFileRes.data)
			},
			fail({errMsg}){
				reject(errMsg)
			}
		});	
		if(callback){
			callback(uploadTask);
		}			
	})
}	
