Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/components/commons/layout/mypage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { useRecoilState } from "recoil";
import { userInfoValue } from "../../store";
import * as s from "./mypage.styles";

export default function LayoutMyPage() {
const [userInfo] = useRecoilState(userInfoValue);
return (
<s.Wrapper>
<s.ProfileWrapper>
<s.ProfileUser>
<s.ProfileImg />
<s.ProfileDetail width="70%">
<s.Text size="1.5rem" color="#333" weight="400">
xxx님, 오늘의 일정이 1건 있습니다.
{userInfo?.nickName}님, 오늘의 일정이 1건 있습니다.
</s.Text>
<s.UserInfoEdit>내정보 수정</s.UserInfoEdit>
</s.ProfileDetail>
Expand All @@ -35,7 +38,7 @@ export default function LayoutMyPage() {
<s.DivideLine />
<s.userInfoNumbers>
<s.Text size="1.5rem" color="#333" weight="700">
1000P
{userInfo?.point}P
</s.Text>
<s.Text size="0.7rem" color="#333" weight="400">
포인트
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import { selectorValue, userInfoValue } from "../../../commons/store";
import MypagePaymentPointUI from "./paymentPoint.presenter";
import { v4 as uuidv4 } from "uuid";
import Head from "next/head";
import { useApolloClient, useMutation } from "@apollo/client";
import { CHARGE_PAYMENT } from "./paymentPoint.queries";
import { useApolloClient, useMutation, useQuery } from "@apollo/client";
import {
CHARGE_PAYMENT,
FETCH_POINT_CHARGE_HISTORY,
} from "./paymentPoint.queries";
import {
IMutation,
IMutationChargePaymentArgs,
IQuery,
} from "../../../../commons/types/generated/types";
import { string } from "yup";
declare const window: typeof globalThis & {
Expand All @@ -24,6 +28,10 @@ export default function MypagePaymentPoint() {
Pick<IMutation, "chargePayment">,
IMutationChargePaymentArgs
>(CHARGE_PAYMENT);
const { data } = useQuery<Pick<IQuery, "fetchPointChargeHistory">>(
FETCH_POINT_CHARGE_HISTORY
);
console.log(data);

const onClickChargePoint = () => {
setChargeBtnState(!chargeBtnState);
Expand Down Expand Up @@ -52,7 +60,7 @@ export default function MypagePaymentPoint() {
const result = await chargePayment({
variables: {
impUid: String(impUid),
amount: parseInt(sortValue),
amount: Number(sortValue),
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import * as s from "./paymentPoint.styles";
import InfiniteScroll from "react-infinite-scroller";
import Selector from "../../../../commons/selector";
import { useRecoilState } from "recoil";
import { selectorValue } from "../../../commons/store";
import { selectorValue, userInfoValue } from "../../../commons/store";
export default function MypagePaymentPointUI(props) {
const [sortValue, setSortValue] = useRecoilState(selectorValue);
const [userInfo] = useRecoilState(userInfoValue);
return (
<s.Wrapper>
<s.PointWrapper>
Expand All @@ -15,7 +16,7 @@ export default function MypagePaymentPointUI(props) {
사용가능한 포인트
</s.Text>
<s.Text size="1.5rem" color="#333" weight="700">
1000P
{userInfo?.point}P
</s.Text>
</s.AvailablePoint>
<s.ChargePoint onClick={props.onClickChargePoint}>
Expand Down
24 changes: 15 additions & 9 deletions src/components/units/myPage/paymentPoint/paymentPoint.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@ export const CHARGE_PAYMENT = gql`
mutation chargePayment($impUid: String!, $amount: Int!) {
chargePayment(impUid: $impUid, amount: $amount) {
id
# impUid
# status
# amount
# user {
# id
# email
# nickName
# point
# }
impUid
status
amount
user {
id
email
nickName
point
}
}
}
`;

export const FETCH_POINT_CHARGE_HISTORY = gql`
query fetchPointChargeHistory {
id
}
`;