[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) {
|
||||
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' };
|
||||
}
|
||||
try {
|
||||
await db.team.create({
|
||||
data: { name: name.toString(), password: genPassword(), language: lang }
|
||||
});
|
||||
} catch {
|
||||
return { success: false, message: 'Database error' };
|
||||
} catch (e) {
|
||||
return { success: false, message: `Database error: ${e}` };
|
||||
}
|
||||
return { success: true };
|
||||
},
|
||||
@ -53,7 +53,7 @@ export const actions = {
|
||||
if (teamId === null || name === null || lang === null || password === null) {
|
||||
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' };
|
||||
}
|
||||
try {
|
||||
|
@ -68,6 +68,7 @@
|
||||
>
|
||||
<option value="Java">Java</option>
|
||||
<option value="CSharp">C#</option>
|
||||
<option value="CPP">C++</option>
|
||||
</select>
|
||||
|
||||
<label class="mt-1 form-label" for="editTeamPassword">Password</label>
|
||||
@ -109,6 +110,7 @@
|
||||
<select id="addTeamLang" name="lang" class="form-select" required>
|
||||
<option value="Java">Java</option>
|
||||
<option value="CSharp">C#</option>
|
||||
<option value="CPP">C++</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
Loading…
Reference in New Issue
Block a user