From cce4b1f1865802b2ed486a78ccdcc534e94145be Mon Sep 17 00:00:00 2001 From: Mathieu Sanchez Date: Thu, 13 Dec 2018 10:55:35 +0900 Subject: [PATCH] Example for API --- src/API/APIUser.php | 10 +++++++--- static/css/style.css | 5 +++++ static/js/javascript.js | 14 +++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/API/APIUser.php b/src/API/APIUser.php index 84ff4c6..4f37fed 100644 --- a/src/API/APIUser.php +++ b/src/API/APIUser.php @@ -5,19 +5,23 @@ namespace WebProjectFitness\API; class APIUser extends API { private $declaredFunctions = [ - 'insert' => [ + 'create' => [ 'method' => 'POST', 'params' => [ - 'name' => [ + 'id' => [ 'required' => true, 'type' => 'string' ] ] - ], + ] ]; public function __construct() { parent::__construct( $this->declaredFunctions ); } + public function create( $data ) { + $this->returnJson( [ 'body' => 'truc', 'id' => $data[ 'id' ] ] ); + } + } \ No newline at end of file diff --git a/static/css/style.css b/static/css/style.css index 3df0ae1..aa0dafd 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -26,4 +26,9 @@ height: 10px; border-radius: 50%; cursor: pointer; + display: none; +} + +#point-container.start .point { + display: inherit; } \ No newline at end of file diff --git a/static/js/javascript.js b/static/js/javascript.js index eeb698d..9737456 100644 --- a/static/js/javascript.js +++ b/static/js/javascript.js @@ -23,8 +23,9 @@ let pointConfig = [ let Point = ( function () { - let Point = function ( conf ) { + let Point = function ( conf, callback ) { this.config = conf; + this.callback = callback; this.addSpecificCSS(); this.adHtml(); }; @@ -36,7 +37,6 @@ let Point = ( function () { let css = `