[web] Ability to add team with CPP
This commit is contained in:
parent
f393636629
commit
face74b314
@ -18,15 +18,15 @@ export const actions = {
|
|||||||
if (name === null || lang === null) {
|
if (name === null || lang === null) {
|
||||||
return { success: false, message: 'Incomplete form data' };
|
return { success: false, message: 'Incomplete form data' };
|
||||||
}
|
}
|
||||||
if (lang !== 'Java' && lang !== 'CSharp') {
|
if (lang !== 'Java' && lang !== 'CSharp' && lang !== 'CPP') {
|
||||||
return { success: false, message: 'Invalid language' };
|
return { success: false, message: 'Invalid language' };
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await db.team.create({
|
await db.team.create({
|
||||||
data: { name: name.toString(), password: genPassword(), language: lang }
|
data: { name: name.toString(), password: genPassword(), language: lang }
|
||||||
});
|
});
|
||||||
} catch {
|
} catch (e) {
|
||||||
return { success: false, message: 'Database error' };
|
return { success: false, message: `Database error: ${e}` };
|
||||||
}
|
}
|
||||||
return { success: true };
|
return { success: true };
|
||||||
},
|
},
|
||||||
@ -53,7 +53,7 @@ export const actions = {
|
|||||||
if (teamId === null || name === null || lang === null || password === null) {
|
if (teamId === null || name === null || lang === null || password === null) {
|
||||||
return { success: false, message: 'Incomplete form data' };
|
return { success: false, message: 'Incomplete form data' };
|
||||||
}
|
}
|
||||||
if (lang !== 'Java' && lang !== 'CSharp') {
|
if (lang !== 'Java' && lang !== 'CSharp' && lang !== 'CPP') {
|
||||||
return { success: false, message: 'Invalid language' };
|
return { success: false, message: 'Invalid language' };
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
>
|
>
|
||||||
<option value="Java">Java</option>
|
<option value="Java">Java</option>
|
||||||
<option value="CSharp">C#</option>
|
<option value="CSharp">C#</option>
|
||||||
|
<option value="CPP">C++</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<label class="mt-1 form-label" for="editTeamPassword">Password</label>
|
<label class="mt-1 form-label" for="editTeamPassword">Password</label>
|
||||||
@ -109,6 +110,7 @@
|
|||||||
<select id="addTeamLang" name="lang" class="form-select" required>
|
<select id="addTeamLang" name="lang" class="form-select" required>
|
||||||
<option value="Java">Java</option>
|
<option value="Java">Java</option>
|
||||||
<option value="CSharp">C#</option>
|
<option value="CSharp">C#</option>
|
||||||
|
<option value="CPP">C++</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
Loading…
Reference in New Issue
Block a user