-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from TripInfoWeb/dev_informations
Feat: 정보 북마크 API 연동 및 페이지네이션 API 재연동
- Loading branch information
Showing
38 changed files
with
478 additions
and
172 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { revalidatePath, revalidateTag } from "next/cache"; | ||
import { NextRequest } from "next/server"; | ||
|
||
/** | ||
* 정보 북마크 등록 | ||
*/ | ||
export async function POST(request: NextRequest) { | ||
const cookie = request.cookies.get("access_token"); | ||
const body = await request.formData(); | ||
|
||
const data = new URLSearchParams(); | ||
data.append("infoId", body.get("infoId")?.toString() ?? "0"); | ||
|
||
const response = await fetch( | ||
`${process.env.BACKEND_URL}/api/bookmark/information`, | ||
{ | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
Cookie: `${cookie?.name}=${cookie?.value}`, | ||
}, | ||
body: data.toString(), | ||
cache: "no-store", | ||
}, | ||
); | ||
|
||
revalidateTag("getBestInformationList"); | ||
revalidatePath("/informations", "layout"); | ||
return response; | ||
} | ||
|
||
/** | ||
* 정보 북마크 취소 | ||
*/ | ||
export async function DELETE(request: NextRequest) { | ||
const cookie = request.cookies.get("access_token"); | ||
const body = await request.formData(); | ||
|
||
const data = new URLSearchParams(); | ||
data.append("infoId", body.get("info")?.toString() ?? "0"); | ||
|
||
const response = await fetch( | ||
`${process.env.BACKEND_URL}/api/bookmark/information`, | ||
{ | ||
method: "DELETE", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
Cookie: `${cookie?.name}=${cookie?.value}`, | ||
}, | ||
body: data.toString(), | ||
cache: "no-store", | ||
}, | ||
); | ||
|
||
revalidateTag("getBestInformationList"); | ||
revalidatePath("/informations", "layout"); | ||
return response; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { revalidatePath, revalidateTag } from "next/cache"; | ||
import { NextRequest } from "next/server"; | ||
|
||
/** | ||
* 정보 좋아요 등록 | ||
*/ | ||
export async function POST(request: NextRequest) { | ||
const cookie = request.cookies.get("access_token"); | ||
const body = await request.formData(); | ||
|
||
const data = new URLSearchParams(); | ||
data.append("infoId", body.get("infoId")?.toString() ?? "0"); | ||
|
||
const response = await fetch( | ||
`${process.env.BACKEND_URL}/api/information/great`, | ||
{ | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
Cookie: `${cookie?.name}=${cookie?.value}`, | ||
}, | ||
body: data.toString(), | ||
cache: "no-store", | ||
}, | ||
); | ||
|
||
revalidateTag("getBestInformationList"); | ||
revalidatePath("/informations", "layout"); | ||
return response; | ||
} | ||
|
||
/** | ||
* 정보 좋아요 취소 | ||
*/ | ||
export async function DELETE(request: NextRequest) { | ||
const cookie = request.cookies.get("access_token"); | ||
const body = await request.formData(); | ||
|
||
const data = new URLSearchParams(); | ||
data.append("infoId", body.get("infoId")?.toString() ?? "0"); | ||
|
||
const response = await fetch( | ||
`${process.env.BACKEND_URL}/api/information/great`, | ||
{ | ||
method: "DELETE", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
Cookie: `${cookie?.name}=${cookie?.value}`, | ||
}, | ||
body: data.toString(), | ||
cache: "no-store", | ||
}, | ||
); | ||
|
||
revalidateTag("getBestInformationList"); | ||
revalidatePath("/informations", "layout"); | ||
return response; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
src/app/informations/list/parent-category/[parentCategoryId]/page.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.