Changeset 3208480
- Timestamp:
- 12/16/2024 10:40:46 AM (15 months ago)
- Location:
- ai-summarizer
- Files:
-
- 2 edited
-
tags/1.0.1/includes/assets/ai-summarizer.js (modified) (2 diffs)
-
trunk/includes/assets/ai-summarizer.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ai-summarizer/tags/1.0.1/includes/assets/ai-summarizer.js
r3205622 r3208480 288 288 * @returns {Object} - The summary response or an error 289 289 */ 290 // async function makeFrontSummaryRequest(data) { 291 // try { 292 // const response = await fetch(aiSummarizer.rest_url_get_summary, { 293 // method: "GET", 294 // headers: { 295 // "Content-Type": "application/json", 296 // "X-WP-Nonce": aiSummarizer.nonce, 297 // }, 298 // body: JSON.stringify(data), 299 // }); 300 // return await response.json(); 301 // } catch (error) { 302 // console.error("Front summary request failed:", error); 303 // return { success: false, error }; 304 // } 305 // } 290 306 async function makeFrontSummaryRequest(data) { 291 307 try { 292 const response = await fetch(aiSummarizer.rest_url_get_summary, { 308 // Convert data object to query parameters 309 const queryParams = new URLSearchParams(data).toString(); 310 const urlWithParams = `${aiSummarizer.rest_url_get_summary}?${queryParams}`; 311 312 const response = await fetch(urlWithParams, { 293 313 method: "GET", 294 314 headers: { … … 296 316 "X-WP-Nonce": aiSummarizer.nonce, 297 317 }, 298 body: JSON.stringify(data),299 318 }); 319 300 320 return await response.json(); 301 321 } catch (error) { -
ai-summarizer/trunk/includes/assets/ai-summarizer.js
r3205622 r3208480 288 288 * @returns {Object} - The summary response or an error 289 289 */ 290 // async function makeFrontSummaryRequest(data) { 291 // try { 292 // const response = await fetch(aiSummarizer.rest_url_get_summary, { 293 // method: "GET", 294 // headers: { 295 // "Content-Type": "application/json", 296 // "X-WP-Nonce": aiSummarizer.nonce, 297 // }, 298 // body: JSON.stringify(data), 299 // }); 300 // return await response.json(); 301 // } catch (error) { 302 // console.error("Front summary request failed:", error); 303 // return { success: false, error }; 304 // } 305 // } 290 306 async function makeFrontSummaryRequest(data) { 291 307 try { 292 const response = await fetch(aiSummarizer.rest_url_get_summary, { 308 // Convert data object to query parameters 309 const queryParams = new URLSearchParams(data).toString(); 310 const urlWithParams = `${aiSummarizer.rest_url_get_summary}?${queryParams}`; 311 312 const response = await fetch(urlWithParams, { 293 313 method: "GET", 294 314 headers: { … … 296 316 "X-WP-Nonce": aiSummarizer.nonce, 297 317 }, 298 body: JSON.stringify(data),299 318 }); 319 300 320 return await response.json(); 301 321 } catch (error) {
Note: See TracChangeset
for help on using the changeset viewer.