- Downline User
- Not registered if already exists. - Forgot Password
This commit is contained in:
25
src/validation/aportadorexist.ts
Normal file
25
src/validation/aportadorexist.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { default as Axios, AxiosResponse } from 'axios'
|
||||
// import { IPayload } from 'model'
|
||||
import { GlobalConfig, PayloadMessageTypes } from '../common'
|
||||
import { tools } from '../store/Modules/tools'
|
||||
|
||||
// const SITE_URL = GlobalConfig.uri.site
|
||||
const VALIDATE_USER_URL = process.env.MONGODB_HOST + '/users/'
|
||||
|
||||
export function aportadorexist(userName: string) {
|
||||
if (userName === tools.APORTADOR_NONE)
|
||||
return true
|
||||
|
||||
let onSuccess = (res: AxiosResponse) => {
|
||||
// console.log('res.status', res.status)
|
||||
return res.status === PayloadMessageTypes.statusfound
|
||||
}
|
||||
|
||||
return Axios.get(VALIDATE_USER_URL + process.env.APP_ID + '/' + userName)
|
||||
.then(onSuccess)
|
||||
.catch((err) => {
|
||||
// console.log('err', err)
|
||||
return false
|
||||
})
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user