feat: update alumno registration to include telefono and curso_id, rename button to 'Registrar'
This commit is contained in:
parent
30b07db07e
commit
1ea33d7097
|
@ -154,7 +154,7 @@ export default function AlumnosManual() {
|
||||||
type="submit"
|
type="submit"
|
||||||
className="bg-green-400 hover:bg-green-500 font-bold py-2 px-4 rounded-md text-black"
|
className="bg-green-400 hover:bg-green-500 font-bold py-2 px-4 rounded-md text-black"
|
||||||
>
|
>
|
||||||
Guardar
|
Registrar
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,14 +8,14 @@ export default async function handler(req, res) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const supabase = createClient({ req, res });
|
const supabase = createClient({ req, res });
|
||||||
const { nombre, correo, nombreCurso } = req.body;
|
const { nombre, correo, telefono, curso_id } = req.body;
|
||||||
|
|
||||||
if (!nombre || !correo || !nombreCurso) {
|
if (!nombre || !correo || !telefono || !curso_id) {
|
||||||
return res.status(400).json({ error: "Faltan datos del alumno" });
|
return res.status(400).json({ error: "Faltan datos del alumno" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data, error } = await supabase.from("alumno").insert([
|
const { data, error } = await supabase.from("alumno").insert([
|
||||||
{ nombre, correo, nombreCurso },
|
{ nombre, correo, telefono, curso_id },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
Loading…
Reference in New Issue