Plugin Directory

Changeset 3208473


Ignore:
Timestamp:
12/16/2024 10:31:44 AM (16 months ago)
Author:
sobolddev
Message:

Fix: Updated makeFrontSummaryRequest to use query parameters for GET requests instead of a body.

Location:
ai-summarizer/tags/1.0.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ai-summarizer/tags/1.0.0/ai-summarizer.php

    r3205629 r3208473  
    77 * Plugin URI: https://sobold.co.uk/
    88 * Description: A WordPress plugin that integrates with AWS Bedrock to generate AI-powered summaries of post content.
    9  * Version: 1.0.0
     9 * Version: 1.0.1
    1010 * Author: Santosh <santosh@soboldltd.com>
    1111 * Author URI: https://sobold.co.uk/team/
  • ai-summarizer/tags/1.0.0/trunk/includes/assets/ai-summarizer.js

    r3205622 r3208473  
    288288     * @returns {Object} - The summary response or an error
    289289     */
     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    // }
     306
    290307    async function makeFrontSummaryRequest(data) {
    291308        try {
    292             const response = await fetch(aiSummarizer.rest_url_get_summary, {
     309            // Convert data object to query parameters
     310            const queryParams = new URLSearchParams(data).toString();
     311            const urlWithParams = `${aiSummarizer.rest_url_get_summary}?${queryParams}`;
     312
     313            const response = await fetch(urlWithParams, {
    293314                method: "GET",
    294315                headers: {
     
    296317                    "X-WP-Nonce": aiSummarizer.nonce,
    297318                },
    298                 body: JSON.stringify(data),
    299319            });
     320
    300321            return await response.json();
    301322        } catch (error) {
  • ai-summarizer/tags/1.0.0/trunk/readme.md

    r3208443 r3208473  
    9191-   REST API routes for summarization and summary approval.
    9292
     93### 1.0.1
     94
     95-   Fix: Update `makeFrontSummaryRequest` to use query parameters for GET requests instead of a body.
     96
    9397## License
    9498
Note: See TracChangeset for help on using the changeset viewer.