Upodated end points

This commit is contained in:
2023-01-28 21:26:36 -05:00
parent 09ddf68c75
commit eadd740484
7 changed files with 228 additions and 19 deletions
+20
View File
@@ -138,6 +138,26 @@ class Myfit extends BaseController
return $this->response->setJson($mCountry->getSiteCountries([]));
}
public function resetpass(){
//header("Access-Control-Allow-Origin: http://localhost:9057 ");
header('Access-Control-Allow-Origin: * ');
header('Access-Control-Expose-Headers: Access-Control-Allow-Origin');
header('Access-Control-Allow-Credentials: true ');
//header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS');
header('Content-type: application/json');
$raw_json = file_get_contents('php://input');
$raw_array = json_decode($raw_json, true);
$res1 = [
'email' => $raw_array['email'],
'status' => 1
];
return $this->response->setJson($res1);
}
public function faq()
{
//header("Access-Control-Allow-Origin: http://localhost:9057 ");
+32 -15
View File
@@ -17,7 +17,7 @@ class Myfituser extends BaseController
public function index()
{
header('Access-Control-Allow-Origin: * ');
/* header('Access-Control-Allow-Origin: * ');
//header("Access-Control-Allow-Origin: http://localhost:9057 ");
header('Access-Control-Expose-Headers: Access-Control-Allow-Origin');
header('Access-Control-Allow-Credentials: true ');
@@ -27,12 +27,11 @@ class Myfituser extends BaseController
$mBlogData = new \App\Models\myfitBlogData();
$res1 = $mBlogData->getBlogData([]);
return $this->response->setJson($res1);
return $this->response->setJson($res1);*/
}
public function users()
{
header('Access-Control-Allow-Origin: *');
//header("Access-Control-Allow-Origin: http://localhost:9057 ");
header('Access-Control-Expose-Headers: Access-Control-Allow-Origin');
@@ -49,8 +48,13 @@ class Myfituser extends BaseController
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
$endpoints = [
'createuser' => ['POST'],
'account' => ['POST'],
'login' => ['POST'],
'reminders' => ['GET'],
'myfeed' => ['GET'],
'calendar' => ['GET'],
'profile' => ['GET'],
'loginhx' => ['GET'],
];
$res1 = [];
@@ -65,28 +69,41 @@ class Myfituser extends BaseController
$raw_array = json_decode($raw_json, true);
switch ($endpoint) {
case "login":
case 'login':
$userAccess = new \App\Models\userAccess();
$res1 = $userAccess->startLogin($raw_array);
break;
case "createuser":
$res= $this->dummyData($raw_array);
case 'account':
$res = $this->dummyData($raw_array);
break;
case 2:
echo "i equals 2";
case 'reminders':
$myfitUserReminders = new \App\Models\myfitUserReminders();
$res1 = $myfitUserReminders->readReminders($raw_array);
break;
case 'myfeed':
$res = $this->dummyData($raw_array);
break;
case 'calendar':
$res = $this->dummyData($raw_array);
break;
case 'profile':
$res = $this->dummyData($raw_array);
break;
case 'loginhx':
$myfitHx = new \App\Models\myfitHx();
$res1 = $myfitHx->readLoginHx($raw_array);
break;
}
return $this->response->setJson($res1);
}
//this is dummy function to establish the endpoints before real implementations
private function dummyData($raw_array){
//this is dummy function to establish the endpoints before real implementations
private function dummyData($raw_array)
{
return [
'msg'=> 'Not implemented yet',
'raw_data' => $raw_array
'msg' => 'Not implemented yet',
'raw_data' => $raw_array,
];
}
public function blogdata()