Skip to content

Commit

Permalink
[#47] Feat CheckSignUpPage
Browse files Browse the repository at this point in the history
- getSignUps API 수정정
  • Loading branch information
JoGeumJu committed Jul 24, 2023
1 parent eace875 commit 9779207
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/apis/controller/adminSignUp.api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sendApi from "../sendApi";

export const AdminSignUpAPI = {
getSignUps: async () => {
const response = await sendApi.get("/orders");
getSignUps: async (isCheck: boolean) => {
const response = await sendApi.get("/orders", { check: isCheck });
return response.data;
},
getSignUpDetail: async (id: number) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/adminPage/AdminDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const AdminDetailPage = () => {
const { id } = Router.query;
const { isLoading, data } = useQueryGetSignUpDetail(Number(id));

console.log(data);

return (
<Wrapper>
<WrapperInner>
Expand Down
11 changes: 5 additions & 6 deletions src/components/adminPage/AdminPage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useState } from "react";
import { useState } from "react";
import styled from "styled-components";
import { useQueryGetSignUps } from "../../hooks/query/adminSignUp/useQueryGetSignUps";
import { customColor } from "../customColor";
import { SignUpItem } from "./components/SignUpItem";
import { SignUpItemListCheck } from "./components/SignUpItemList";
import { SignUpItemListUncheck } from "./components/SignUpItemListUncheck";

export interface ResponseType {
clientName: string;
Expand All @@ -16,12 +16,11 @@ interface ToggleProps {
}

export const AdminPage = () => {
const { isLoading, data } = useQueryGetSignUps();
const [isNew, setIsNew] = useState(true);

return (
<Wrapper>
{!isLoading && data?.map((i, id) => <SignUpItem data={i} key={id} />)}
{!isLoading && data?.map((i, id) => <SignUpItem data={i} key={id} />)}
{isNew ? <SignUpItemListUncheck /> : <SignUpItemListCheck />}
<ToggleButton onClick={() => setIsNew(!isNew)}>
<ToggleButtonInner>
<ButtonThumb isNew={isNew} />
Expand Down
14 changes: 14 additions & 0 deletions src/components/adminPage/components/SignUpItemList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import styled from "styled-components";
import { useQueryGetSignUps } from "../../../hooks/query/adminSignUp/useQueryGetSignUps";
import { SignUpItem } from "./SignUpItem";

export const SignUpItemListCheck = () => {
const { isLoading, data } = useQueryGetSignUps(true);
return (
<>{!isLoading && data?.map((i, id) => <SignUpItem data={i} key={id} />)}</>
);
};

const Wrapper = styled.div`
display: flex;
`;
14 changes: 14 additions & 0 deletions src/components/adminPage/components/SignUpItemListUncheck.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import styled from "styled-components";
import { useQueryGetSignUps } from "../../../hooks/query/adminSignUp/useQueryGetSignUps";
import { SignUpItem } from "./SignUpItem";

export const SignUpItemListUncheck = () => {
const { isLoading, data } = useQueryGetSignUps(false);
return (
<>{!isLoading && data?.map((i, id) => <SignUpItem data={i} key={id} />)}</>
);
};

const Wrapper = styled.div`
display: flex;
`;
4 changes: 2 additions & 2 deletions src/hooks/query/adminSignUp/useQueryGetSignUps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export interface ResponseType {
siteName: string;
}

export const useQueryGetSignUps = () => {
export const useQueryGetSignUps = (isCheck: boolean) => {
const load = useCallback(async () => {
const response = await AdminSignUpAPI.getSignUps();
const response = await AdminSignUpAPI.getSignUps(isCheck);
const signUpsRes: ResponseType[] = [];
response.content.map((i: ResponseType) => {
signUpsRes.push({
Expand Down

0 comments on commit 9779207

Please sign in to comment.