Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit a78fc5e

Browse files
committed
fix: 잘못된 endpoint 수정
1 parent c01331f commit a78fc5e

File tree

4 files changed

+22
-116
lines changed

4 files changed

+22
-116
lines changed

backend/api/add_bookmark_blog/lambda_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def get_user_profile(username: str) -> str:
3636

3737
def lambda_handler(event, context):
3838
user_id = event.get("pathParameters", {}).get("user_id", None)
39-
blog_id = event.get("body", {}).get("blog_id", None)
39+
blog_id = event.get("pathParameters", {}).get("blog_id", None)
4040

4141
if user_id is None:
4242
return {

backend/api/delete_bookmark_blog/lambda_function.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
import models
33
import json
44
from typing import Optional
5-
import requests
65

76

87
def lambda_handler(event, context):
98
user_id = event.get("pathParameters", {}).get("user_id", None)
10-
blog_id = event.get("body", {}).get("blog_id", None)
9+
blog_id = event.get("pathParameters", {}).get("blog_id", None)
1110

1211
if user_id is None:
1312
return {

frontend/src/background.js

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,6 @@ async function onUpdated(tabId) {
126126
})
127127
.catch((err) => console.log(err));
128128
}
129-
// 검색 페이지에 쿼리가 들어가 있다면
130-
if (
131-
tab.status == "complete" &&
132-
/^http/.test(tab.url) &&
133-
tab.url.slice(0, 23) === "https://velog.io/search"
134-
) {
135-
browser.scripting.executeScript({
136-
target: { tabId: tab.id },
137-
files: ["./src/util.js", "./src/search.js"],
138-
});
139-
}
140129
}
141130

142131
browser.tabs.onUpdated.addListener(async (tabID, changeInfo, tab) => {
@@ -152,16 +141,16 @@ browser.tabs.onReplaced.addListener(async (addedTabId, removedTabId) => {
152141
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
153142
if (request.message === "add_bookmark") {
154143
browser.storage.local.get(["user_id", "user_email"], (data) => {
155-
fetch(`${Constants.BACKEND_URL}/user/${data.user_id}/blog`, {
156-
method: "POST",
157-
headers: {
158-
"Content-Type": "application/json",
159-
Accept: "application/json",
160-
},
161-
body: JSON.stringify({
162-
blog_id: request.payload,
163-
}),
164-
})
144+
fetch(
145+
`${Constants.BACKEND_URL}/user/${data.user_id}/blog/${request.payload}`,
146+
{
147+
method: "POST",
148+
headers: {
149+
"Content-Type": "application/json",
150+
Accept: "application/json",
151+
},
152+
}
153+
)
165154
.then((response) => {
166155
if (response.status === 204) {
167156
sendResponse({ message: "success" });
@@ -174,16 +163,16 @@ browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
174163
});
175164
} else if (request.message === "delete_bookmark") {
176165
browser.storage.local.get(["user_id", "user_email"], (data) => {
177-
fetch(`${Constants.BACKEND_URL}/user/${data.user_id}/blog`, {
178-
method: "DELETE",
179-
headers: {
180-
"Content-Type": "application/json",
181-
Accept: "application/json",
182-
},
183-
body: JSON.stringify({
184-
blog_id: request.payload,
185-
}),
186-
})
166+
fetch(
167+
`${Constants.BACKEND_URL}/user/${data.user_id}/blog/${request.payload}`,
168+
{
169+
method: "DELETE",
170+
headers: {
171+
"Content-Type": "application/json",
172+
Accept: "application/json",
173+
},
174+
}
175+
)
187176
.then((response) => {
188177
if (response.status === 204) {
189178
sendResponse({ message: "success" });

frontend/src/search.js

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)