Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revalidate가 안되는 버그를 수정했습니다. #103

Merged
merged 4 commits into from
Nov 29, 2023
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
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