@@ -126,17 +126,6 @@ async function onUpdated(tabId) {
126126 } )
127127 . catch ( ( err ) => console . log ( err ) ) ;
128128 }
129- // 검색 페이지에 쿼리가 들어가 있다면
130- if (
131- tab . status == "complete" &&
132- / ^ h t t p / . 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
142131browser . tabs . onUpdated . addListener ( async ( tabID , changeInfo , tab ) => {
@@ -152,16 +141,16 @@ browser.tabs.onReplaced.addListener(async (addedTabId, removedTabId) => {
152141browser . 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" } ) ;
0 commit comments