215 lines
7.4 KiB
JavaScript
215 lines
7.4 KiB
JavaScript
import React from "react";
|
|
import Axios from "axios";
|
|
|
|
class usersService {
|
|
constructor() {
|
|
console.log("WRB Service Entry");
|
|
}
|
|
|
|
getHomeDate(){
|
|
var postData = {
|
|
uuid: localStorage.getItem("uuid"),
|
|
member_id: localStorage.getItem("member_id"),
|
|
sessionid: localStorage.getItem("session_token")
|
|
};
|
|
return this.postAuxEnd("/dashdata", postData);
|
|
}
|
|
logInUser(reqData) {
|
|
localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/userlogin", reqData);
|
|
}
|
|
marketJobData(reqData) {
|
|
var postData = {
|
|
uuid: localStorage.getItem("uuid"),
|
|
member_id: localStorage.getItem("member_id"),
|
|
sessionid: localStorage.getItem("session_token")
|
|
};
|
|
return this.postAuxEnd("/getjobsdata", postData);
|
|
}
|
|
|
|
getApiGate(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/apigate", null);
|
|
}
|
|
|
|
CreateUser(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/createuser", null);
|
|
}
|
|
|
|
getLoadProfile(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/loadprofile", null);
|
|
}
|
|
|
|
getOffersList(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/offerslist", null);
|
|
}
|
|
|
|
getPendingJob(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/pendingjob", null);
|
|
}
|
|
|
|
getActiveJobList(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/activejoblist", null);
|
|
}
|
|
|
|
getGetPendingJobs(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/getpendingjobs", null);
|
|
}
|
|
|
|
getUsersCards(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/userscards", null);
|
|
}
|
|
|
|
getCouponPending(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/couponpending", null);
|
|
}
|
|
|
|
getCouponHx(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/couponhx", null);
|
|
}
|
|
|
|
getCouponRedeem(){
|
|
// localStorage.setItem("session_token", ``);
|
|
return this.postAuxEnd("/couponredeem", null);
|
|
}
|
|
|
|
/*
|
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(sessionid)
|
|
|
|
|
|
$endpoints = array(
|
|
'apigate' => array('POST'),
|
|
'generics' => array('POST'),
|
|
'createuser' => array('POST'),
|
|
'createmobileuser' => array('POST'),
|
|
'completemobileuser' => array('POST'),
|
|
'startresetpasword' => array('POST'),
|
|
'userlogin' => array('POST'),
|
|
'startjoblist' => array('POST'),
|
|
'dashdata' => array('POST'),
|
|
'getjobsdata' => array('POST'),
|
|
'offerslist' => array('POST'),
|
|
'activejoblist' => array('POST'),
|
|
'loadprofile' => array('POST'),
|
|
'account' => array('POST'),
|
|
'message' => array('POST'),
|
|
'pendingjob' => array('POST'),
|
|
'paymenthx' => array('POST'),
|
|
'getjob' => array('POST'),
|
|
'mybanklist' => array('POST'),
|
|
'sendmoney' => array('POST'),
|
|
'sendinterest' => array('POST'),
|
|
'sendmoneyfee' => array('POST'),
|
|
'getpendingjobs' => array('POST'),
|
|
'taskmessage' => array('POST'),
|
|
'sendtaskmessage' => array('POST'),
|
|
'getwallets' => array('POST'),
|
|
'sitecontact' => array('POST'),
|
|
'signupcountry' => array('POST'),
|
|
'userscards' => array('POST'),
|
|
'blogdata' => array('POST'),
|
|
'blogitem' => array('POST'),
|
|
'couponhx' => array('POST'),
|
|
'couponpending' => array('POST'),
|
|
'couponredeem' => array('POST'),
|
|
'sendinterestmessage' => array('POST'),
|
|
'replyinterestmessage' => array('POST')
|
|
);
|
|
|
|
*/
|
|
|
|
getUserReminders(){
|
|
return this.getAuxEnd("/reminders", null);
|
|
}
|
|
//---------------------------------------- -----
|
|
//---------------------------------------- -----
|
|
// Unified call below
|
|
//---------------------------------------- -----
|
|
//---------------------------------------- -----
|
|
getAuxEnd(uri, reqData) {
|
|
const session_token = localStorage.getItem("session_token");
|
|
let axiosConfig = {
|
|
headers: {
|
|
'Accept': 'application/json',
|
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
'Authorization': `Basic ${session_token}`,
|
|
}
|
|
};
|
|
const endPoint = process.env.REACT_APP_USERS_ENDPOINT + uri;
|
|
return Axios.get(endPoint,{
|
|
params: {
|
|
reqData
|
|
}})
|
|
.then((response) => {
|
|
console.log("~~~~~~~ Toks2 GET ~~~~~~~~");
|
|
return response;
|
|
})
|
|
.catch((error) => {
|
|
if (error.response) {
|
|
//response status is an error code
|
|
console.log(error.response.status);
|
|
} else if (error.request) {
|
|
//response not received though the request was sent
|
|
console.log(error.request);
|
|
} else {
|
|
//an error occurred when setting up the request
|
|
console.log(error.message);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
postAuxEnd(uri, reqData) {
|
|
const endPoint = process.env.REACT_APP_USERS_ENDPOINT + uri;
|
|
const session_token = localStorage.getItem("session_token");
|
|
let axiosConfig = {
|
|
headers: {
|
|
'Accept': 'application/json',
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
'Authorization': `Basic ${session_token}`,
|
|
}
|
|
};
|
|
// Axios.defaults.headers.post['Content-Type'] ='application/json;charset=utf-8';
|
|
// Axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; //,axiosConfig
|
|
return Axios.post(endPoint, reqData)
|
|
.then((response) => {
|
|
console.log(response);
|
|
// res = response;
|
|
console.log("~~~~~~~ Toks2 POST ~~~~~~~~");
|
|
return response;
|
|
})
|
|
.catch((error) => {
|
|
if (error.response) {
|
|
//response status is an error code
|
|
console.log("ERROR-------------------------------------------------------");
|
|
console.log(error.response.status);
|
|
console.log("ERROR-------------------------------------------------------");
|
|
} else if (error.request) {
|
|
//response not received though the request was sent
|
|
console.log("ERROR2-------------------------------------------------------");
|
|
console.log(error.request);
|
|
console.log("ERROR2-------------------------------------------------------");
|
|
} else {
|
|
//an error occurred when setting up the request
|
|
console.log("ERROR3-------------------------------------------------------");
|
|
console.log(error.message);
|
|
console.log("ERROR3-------------------------------------------------------");
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
export default usersService;
|