import { hideLoading, showLoading } from '../utils/plugIn/globalLoading.js'
import { J_STORAGE_KEY } from './constant'

// const NET = require('../utils/request')
const API = require('../config/api')
export function doPointRequest(data) {
	// return NET.request(API.doPointer, data, 'post')
	return new Promise((resolve, reject) => {
		const header = {
			'Content-Type': 'application/json'
		}
		const res = uni.getStorageSync(J_STORAGE_KEY)
		const token = res.token
		if (token) {
			header.Authorization = token
		}
		uni.request({
			url: API.doPointer,
			data,
			method: 'post',
			header,
			success: (res) => {
				resolve(res)
			},
			fail: (res) => {
				reject(res)
			}
		})
	})
}
