Introduce Edit actions #8
Merged
maxime.batista
merged 10 commits from editor/bootstrap
into master
1 year ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'editor/bootstrap'
Deleting a branch is permanent. It CANNOT be undone. Continue?
This PR introduces the actions to create and edit tactics.
actions added :
PHP and JavaScript often use the camelCase naming convention.
/**
* This constant defines the API endpoint.
*/
export const API = import.meta.env.VITE_API_ENDPOINT;
This does not pass the TypeScript type checking. Add
"types": ["vite/client"],
to thetsconfig.json
.//FIXME avoid absolute path as they would not work on staging server
fetch(`${API}/tactic/${id}/edit/name`, {
method: "POST",
body: JSON.stringify({
It is recommended to specify the
Content-Type
of the request:"@types/node": "^16.18.59",
"@types/react": "^18.2.31",
"@types/react-dom": "^18.2.14",
"node-promises": "^0.2.1",
This module is not used.
if ($match == null) {
echo "404 not found";
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
Headers must be sent before the body.
exit(1);
}
call_user_func_array($match['target'], $match['params']);
The API only return JSON, so it can be specified here.
CREATE TABLE TacticInfo(
id integer PRIMARY KEY AUTOINCREMENT,
name varchar,
creation_date timestamp
return $this->name;
}
public function getCreationDate(): int {
$this->con = $con;
}
public function get(int $id): TacticInfo {
This should return
?TacticInfo
, the id will not always be found in the database."INSERT INTO TacticInfo(name, creation_date) VALUES(:name, CURRENT_TIMESTAMP)",
[":name" => [$name, PDO::PARAM_STR]]
);
$row = $this->con->fetch("SELECT id, creation_date FROM TacticInfo ORDER BY id DESC LIMIT 1", [])[0];
You may be interested in using PDO::lastInsertId.
plugins: [
react()
react(),
cssInjectedByJsPlugin({
Couldn't the CSS be a standalone file (bundled by Vite) and not integrated in JS?
86373fb81b
into master 1 year agoReviewers
86373fb81b
.