注册功能
This commit is contained in:
28
src/api/register.js
Normal file
28
src/api/register.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import axios from 'axios'
|
||||
|
||||
// 创建独立的 axios 实例,避免被全局拦截器影响
|
||||
const registerAxios = axios.create({
|
||||
timeout: 30000,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
|
||||
// 注册接口使用 tkNewAdmin 后端
|
||||
const REGISTER_BASE_URL = process.env.NODE_ENV === 'development'
|
||||
? 'http://192.168.2.22:48080'
|
||||
: 'https://backstageapi.yolozs.com'
|
||||
|
||||
/**
|
||||
* 租户注册
|
||||
* 调用 tkNewAdmin 后端的 /admin-api/system/tenant/register 接口
|
||||
*/
|
||||
export function tenantRegister(data) {
|
||||
return registerAxios.post(`${REGISTER_BASE_URL}/admin-api/system/tenant/register`, data)
|
||||
.then(res => {
|
||||
console.log('注册返回', res)
|
||||
if (res.data && res.data.code === 0) {
|
||||
return res.data.data
|
||||
}
|
||||
const msg = (res.data && res.data.msg) || (res.data && res.data.message) || '注册失败'
|
||||
return Promise.reject(new Error(msg))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user