import { CUSTOME_REQUESTER, RequesterFunc, RequestOptions } from 'vue-vulcan';
import { request, showToast } from '@tarojs/taro';

export function useCustomeRequest(): RequesterFunc {
    return function (url: string, reqs: RequestOptions) {        
        return request({            
            ...reqs,
            url,
            fail(err) {
                showToast({title: '网络错误，请稍后再试', icon: 'none'})
            }
        }) as Promise<any>
    };
}

useCustomeRequest.token = CUSTOME_REQUESTER;