Skip to content

Commit eb20930

Browse files
initial students
1 parent 1e999e6 commit eb20930

File tree

4 files changed

+303
-25
lines changed

4 files changed

+303
-25
lines changed

src/app/attendance/page.tsx renamed to src/app/attendance/page.jsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
'use client'
12
import React from "react";
23
import Link from "next/link";
34
import Image from "next/image";
45
import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb";
56
import { Metadata } from "next";
67
import DefaultLayout from "@/components/Layouts/DefaultLayout";
78
import StudentsPresentCard from "@/components/StudentsPresentCard";
9+
import { useEffect, useState } from "react";
10+
import {db} from "@/firebase/config"
11+
import { collection, getDocs } from "firebase/firestore";
812
// reg no, name, phone number, room number
913

1014

@@ -31,7 +35,25 @@ const brandData = [
3135
];
3236

3337

34-
const Attendance: React.FC = () => {
38+
const Attendance = () => {
39+
40+
const [students, setStudents] = useState([]);
41+
42+
useEffect(() => {
43+
const getStudents = async () => {
44+
const studentsCol = collection(db, "students");
45+
const studentSnapshot = await getDocs(studentsCol);
46+
const studentList = studentSnapshot.docs.map(doc => doc.data());
47+
console.log(studentList);
48+
setStudents(studentList);
49+
}
50+
getStudents();
51+
52+
console.log("students : ",students);
53+
}, []);
54+
55+
console.log(students);
56+
3557
return (
3658
<DefaultLayout>
3759
<h1 className="text-3xl py-5">Hostel Attendance</h1>

0 commit comments

Comments
 (0)