Skip to content

Commit

Permalink
#12 Add userInfo ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
limyeonsang committed Jul 13, 2022
1 parent 9be6e97 commit 9a9596c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pages/myPage/userInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import { UserInfo } from "@views/myPage";
import styled from "@emotion/styled";
import { GetServerSideProps } from "next";
import { dehydrate, QueryClient } from "react-query";
import queryKey from "@constants/queryKey";
import { getMyInfo } from "@apis/myPage";

const UserInfoContainer = () => (
<Container>
<UserInfo />
</Container>
);

export const getServerSideProps: GetServerSideProps = async () => {
const queryClient = new QueryClient();

await queryClient.prefetchQuery([queryKey.myInfo], getMyInfo);

return {
props: {
dehydratedState: dehydrate(queryClient),
},
};
};

export default UserInfoContainer;

const Container = styled.section`
Expand Down

0 comments on commit 9a9596c

Please sign in to comment.