Skip to content

Commit

Permalink
Merge pull request #103 from bssm-portfolio/fix/private-error
Browse files Browse the repository at this point in the history
revalidate가 안되는 버그를 수정했습니다.
  • Loading branch information
J1min authored Nov 29, 2023
2 parents 8cd2477 + 3a362f4 commit 85ddd2c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 38 deletions.
2 changes: 1 addition & 1 deletion config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface Config {

const createConfig: () => Config = () => {
if (!process.env.NEXT_PUBLIC_SERVER_URL) throw new Error("no api server url");
if (!process.env.NODE_ENV) throw new Error("no node env ");
if (!process.env.NODE_ENV) throw new Error("no node env");

return {
baseURL: process.env.NEXT_PUBLIC_SERVER_URL,
Expand Down
19 changes: 0 additions & 19 deletions pages/api/revalidate-portfolio.ts

This file was deleted.

13 changes: 3 additions & 10 deletions pages/portfolio/[portfolioId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
PortfolioPlayer,
AppSideMenu,
} from "@/components";
import type { GetStaticProps } from "next";
import type { GetServerSideProps } from "next";
import httpClient from "@/apis";
import { Portfolio } from "@/types/portfolio.interface";
import { getFileDownloadUrl } from "@/utils/file";
Expand Down Expand Up @@ -106,15 +106,9 @@ export default function PortfolioIdPage({
);
}

export const getStaticPaths = async () => {
return {
paths: [],
fallback: "blocking",
};
};
export const getServerSideProps: GetServerSideProps = async (context) => {
const { portfolioId } = context.query;

export const getStaticProps: GetStaticProps = async (context) => {
const portfolioId = context.params ? context.params.portfolioId : 0;
const { data: portfolio, is403 } = await httpClient.portfolio
.getById({
params: { id: portfolioId },
Expand All @@ -128,6 +122,5 @@ export const getStaticProps: GetStaticProps = async (context) => {
portfolioId,
is403,
},
revalidate: 6000,
};
};
8 changes: 0 additions & 8 deletions utils/date.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ test("koreanDate test - after 2000", () => {
expect(getKoreanDate(new Date("December 17, 2005"))).toBe("2005년 12월 17일");
});

test("timeAgo test - before 2000", () => {
expect(getTimeAgo(new Date("December 17, 1995"))).toBe("27년 전");
});

test("timeAgo test - after 2000", () => {
expect(getTimeAgo(new Date("December 17, 2005"))).toBe("17년 전");
});

test("timeAgo test - now", () => {
expect(getTimeAgo(new Date())).toBe("방금");
});
Expand Down

0 comments on commit 85ddd2c

Please sign in to comment.