vite配置
server: {
proxy:{
'/api/': {
target: 'https://onramper.tech/',
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '')
}
}
}
api配置
/*
* @Date: 2022-04-02 10:06:51
* @LastEditTime: 2022-04-02 15:19:06
*/
import fly from 'flyio'
fly.config.baseURL = "/api";
// 处理代理
/**
* @description: 验证邮箱订单
* @param {string} apiKey, params
* @return {*}
*/
export function vertifyOrder(apiKey, params) {
return fly.post(`/wayPoint/Moonpay/email/${apiKey}`, params, {
headers: {
authority: "onramper.tech",
authorization:
"Basic pk_test_x5M_5fdXzn1fxK04seu0JgFjGsu7CH8lOvS9xZWzuSM0",
},
});
}
export function getFee() {
return fly.get("/partner/fees", null, {
headers: {
authority: "onramper.tech",
authorization:
"Basic pk_test_x5M_5fdXzn1fxK04seu0JgFjGsu7CH8lOvS9xZWzuSM0",
},
});
}
export function vertifyEmail(apiKey, email) {
fly.config.baseURL = "https://api.moonpay.io/";
return fly.post(`/v3/customers/email_login/${apiKey}`, { email });
}
export function emailLogin(apiKey, {email,securityCode}) {
fly.config.baseURL = "https://api.moonpay.io/";
return fly.post(`/v3/customers/email_login?apiKey=` + apiKey, { email,securityCode });
}
控制台请求显示
实际请求url: https://onramper.tech/partner/fees