Skip to content
Snippets Groups Projects
Commit 29584421 authored by Thomas Bouquet's avatar Thomas Bouquet
Browse files

insert ignore

parent 23d634fb
Branches
No related tags found
No related merge requests found
......@@ -117,7 +117,7 @@ function addNewParticipant(req, res){
function addNewParticipantWithId(req, res){
var con = mysql.createConnection(dbConfig);
var query = "INSERT INTO `Participant` (`id`, `name`) VALUES ("+req.body.id+",'"+req.body.name+"');"
var query = "INSERT IGNORE INTO `Participant` (`id`, `name`) VALUES ("+req.body.id+",'"+req.body.name+"');"
con.connect();
con.query(query, (err, result) => {
if(err){
......
......@@ -6,8 +6,6 @@ import { useIsParticipant } from "../../hooks/authTools";
function Submit (props) {
const exists = useIsParticipant({id: 4});
/*var [participants,setParticipants] = useState([]);
useEffect(() => {
const interval = setInterval(() => {
......@@ -33,26 +31,18 @@ function Submit (props) {
{
score: props.score,
equipe: props.equipe.value,
participant: props.participant.value
participant: 100//props.participant.value
})
.then(() => {
alert("Score ajouté");
}, (error) => {
console.log(error);
}).then(() => {
if (!exists){
axios.post('/api/admin/new_participant_with_id',
{
id: 17,
id: 100,//props.participant.value,
name: props.participant.label
})
.then(() => {
alert("Participant ajouté");
alert("Score ajouté");
window.location='/Input';
}, (error) => {
console.log(error);
});
};
})
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment