Skip to content

Commit

Permalink
⚡️ :: (#118) student 리스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kimulchan committed May 31, 2022
1 parent 2b4ac59 commit c8e3241
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/components/home/lists/StudentList.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import UserDetail from "@src/components/userDetail";
import { ModalsDispatchContext } from "@src/contexts/ModalContext";
import fetcher from "@src/utils/function/fetcher";
import { StudentType } from "@src/utils/interfaces/student";
import React, { FC } from "react";
import React, { useContext } from "react";
import useSWR from "swr";
import StudentCard from "../cards/StudentCard";

interface Props {
data: StudentType[];
}

const StudentList = ({ data }) => {
const StudentList = () => {
const { data } = useSWR(
"/teachers/users/search?page=0&scope=ALL&sort=NAME&grade=&class=",
fetcher
);
const { open } = useContext(ModalsDispatchContext);
console.log(data?.user_list);
return (
<>
{data.user_list?.map((i: StudentType) => {
{(data?.user_list || []).map((i: StudentType) => {
return (
<div style={{ marginBottom: "16px" }} key={`${i.name}-${i.user_id}`}>
<div
style={{ marginBottom: "16px" }}
key={i.user_id}
onClick={() => open(UserDetail, { userId: i.user_id })}
>
<StudentCard {...i} />
</div>
);
Expand Down

0 comments on commit c8e3241

Please sign in to comment.