import httpRequest from '@/module/request/http-request.js'
import ipConfig from '@/config/ip.config.js'

const api = {
	login: ipConfig.api_app + '/sso/v2/login',
	guestLogin: ipConfig.api_app + '/sso/guest',
	getOtp: ipConfig.api_app + '/sms/send',
	passwordLoginApi: ipConfig.api_app + '/sso/login',
	idPasswordLogin: ipConfig.api_app + '/sso/idlogin',
	loginConfigApi: ipConfig.api_app + "/threeLogin/channel",
	registerApiUrl: ipConfig.api_app + "/sso/register",
	changePasswordUrl: ipConfig.api_app + "/sso/modify",
	googleLogin: ipConfig.api_app + '/sso/googleLogin'
}
/**
 * 修改Miami
 */
export const changePasswordApi = (params) => {
	return httpRequest.post({
		url: api.changePasswordUrl,
		data: params
	})
}
/**
 * 手机号+密码 注册
 */
export const registerApi = (params) => {
	return httpRequest.post({
		url: api.registerApiUrl,
		data: params
	})
}
/**
 * 获取三方登录配置
 */
export const getLoginConfigApi = (params) => {
	return httpRequest.get({
		url: api.loginConfigApi,
		data: params
	})
}

/**
 * 登录获取sign uid和用户信息
 */
export const requestLogin = (params) => {
	return httpRequest.post({
		url: api.login,
		data: params
	})
}
/**
 * 登陆  手机号+密码
 */
export const passwordLogin = (params) => {
	return httpRequest.post({
		url: api.passwordLoginApi,
		data: params
	})
}
/**
 * 游客登录获取sign uid和用户信息 
 */
export const requestGuestLogin = (params) => {
	return httpRequest.post({
		url: api.guestLogin,
		data: params
	})
}


/**
 * 获取Otp
 */
export const requestGetOtp = (params) => {
	return httpRequest.post({
		url: api.getOtp,
		data: params
	})
}

/**
 * google登录
 */
export const requestGoogleLogin = (params) => {
	return httpRequest.post({
		url: api.googleLogin,
		data: params
	})
}

/**
 * id + password登录
 */
export const requestIdPasswordLogin = (params) => {
	return httpRequest.post({
		url: api.idPasswordLogin,
		data: params
	})
}
