Sharp.js: Output to Lossless WebP Changes Fully Transparent Pixel Color

I’m writing a script that reads image files, manipulates (resets the color of fully transparent pixels to pure black, crops the images), and writes the exports the output images to the lossless WebP. I’m using the Sharp.js library.

The output image is written from a buffer which is a 1D array of RGBA pixel data (a cropped image). console.log(imgBuffer); gives:
<Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 19246 more bytes>

console.log(imgBuffer.slice(imgBuffer.length - 50, imgBuffer.length)); gives the last bytes:
<Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>

Here is the code that write the buffer to an image file:

sharp(imgBuffer, {
    raw: {
      height: bin.height,
      width: bin.width,
      channels: 4
    }})
  .webp({ lossless: true, quality: 100, alphaQuality: 100, force: true })
  .toFile('output.webp');

However, the output image contains “distorted” colors for some of the fully transparent pixels.

Here is an example of an input file. As it is seen, the fully transparent pixels have pure black color (here, I’m using GIMP to manipulate Alpha channel).
Input

Here is an example of an output WebP file. As it is seen, the fully transparent pixels have different colors than in the input file.
Output

Question: In Sharp.js, how to prevent transparent pixels color change during export?

Still got DEPRECATED messages in the dev log file

  • Prestashop 8.2
  • PHP 8.3

In my defines.inc.php I have:

define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false);


    /* Compatibility warning */
    if (!defined('_PS_DISPLAY_COMPATIBILITY_WARNING_')) {
    define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false);
    }
    if (_PS_MODE_DEV_ === true) {
        $errorReportingLevel = E_ALL | E_STRICT;
       // if (_PS_DISPLAY_COMPATIBILITY_WARNING_ === false) {
            $errorReportingLevel = $errorReportingLevel & ~E_DEPRECATED & ~E_USER_DEPRECATED;
      //  }
        @ini_set('display_errors', 'on');
        @error_reporting($errorReportingLevel);
        define('_PS_DEBUG_SQL_', true);
    
        @error_reporting(E_ERROR | E_WARNING | E_PARSE);
    
    
    } else {
        @ini_set('display_errors', 'off');
        define('_PS_DEBUG_SQL_', false);
    }

But I still get a lot of deprecated messages in the var/logs dev file

Then the __contruct method of my module I added:

error_log('[NICO] error_reporting = ' . error_reporting());

Then in my apache log I got:

[NICO] error_reporting = -1,

Which means the error_reporting is not defined in defines.inc.php.

Any idea?

It is a fresh install of PHP, without any module, except the one I try to develop.

PHP $_SERVER[‘DOCUMENT_ROOT’] removed a slash

I read other posts about $_SERVER[‘DOCUMENT_ROOT’] (like this) but what happened to me is that all the pages in my website basically lost the slash overnight.

I didn’t change anything neither to the pages nor the config files…
What can I have done wrong to trigger this?

Is there a faster way to solve it than just update every single page?
I use $_SERVER[‘DOCUMENT_ROOT’] . ‘/folder/library.php’ pretty much in every file, so it’s going to take a while (and a lot of pages not working) before to correct them all.

TA

PHP: Call to undefined function broken in php 8.2 [duplicate]

I have a php script which takes in a photo and positions it accordingly in my web page.

I’ve been using it for years now with php 7.4 but when my ISP upgraded php to 8.2, it broke.

The web page that accesses it (simplified) looks like this:

<html>
    <head>
        <title>PHP Test</title>
      <?
  require ("photos_placement_simple.inc");
  ?>
    </head>
    <body>
    <?php
error_reporting(E_ALL); 
ini_set('display_errors', TRUE); 
ini_set('display_startup_errors', TRUE);

?>
        <?php echo '<p>Hello World</p>';
        
        $result1 = getimagesize("../VCSC_articles/images-articles/1957-Airbox-Corvette-970679_a" . "_s.jpg");
        
        echo"$result1 is $result1[1]<br />n";
        echo"$result2 is $result1[2]<br />n";
        echo"$result3 is $result1[3]<br />n";
        
        ?>
        
        <?php
one_photo ('1957-Airbox-Corvette-970679_a', '1957 Airbox Corvette Sold at Mecum Auctions');
?>
    </body>
</html>

The php script that is accessed (photos_placement_simple.inc) is (again simplified):

<?php

function one_photo($photo1, $photo1_title)  {

// Lets determine the height and width of the graphic
$result1 = getimagesize("../VCSC_articles/images-articles/$photo1" . "_s.jpg");
$left = (390 - ($result1[0] / 2)) + 10;
$height = $result1[1] + 10;

echo "<div style="height:"."$height"."px;">n";
echo "<span style="position:absolute; left:" . $left . "px;">n";
echo "<a href="../../VCSC_articles/images-articles/$photo1.jpg"  rel="lytebox" ";
if (isset($photo1_title)){echo "title="$photo1_title">";}
echo "<img src="../../VCSC_articles/images-articles/"."$photo1"."_s.jpg" alt="$photo1_title" width="$result1[0]" height="$result1[1]" border="0"></a>n";
echo "</span>n";
echo "</div>nn";
    }
?>

The fatal error occurs at the one_photo (‘1957-Airbox-Corvette-970679_a’, ‘1957 Airbox Corvette Sold at Mecum Auctions’); line. The error is “Uncaught Error: Call to undefined function one_photo()” so I guess my question is: How do I define the one_photo() function?

I have the ability to rollback to php 7.4 via .htaccess so it all works for my users. Still I want to be able to use the latest php version. The site is hardcoded via BBEdit, not WordPress, etc.

Comments, suggestions and solutions are appreciated.

~paul

I can’t delete previously selected data in choice.js [closed]

Here I have a problem using choice.js, where the data selected in the first dropdown still appears in other dropdowns. Here I have added a dropdown update function in other functions, the results are still the same. data still appears in all dropdowns even though it has been selected

I use choice.js it is used to be responsive from desktop to mobile. maybe there are options other than choice.js?

function initChoicesOnNewSelect(selectElement) {
  if (!$(selectElement).hasClass('choices-initialized')) {
    new Choices(selectElement, {
      searchEnabled: false,
      itemSelectText: '',
    });
    $(selectElement).addClass('choices-initialized');
  }
}

function updateDropdownOptions() {
  var selectedValues = [];

  // Ambil semua nilai yang sudah dipilih di dropdown
  $('.gejala-select').each(function() {
    var selectedValue = $(this).val();
    if (selectedValue !== "") {
      selectedValues.push(selectedValue);
    }
  });

  $('.gejala-select').each(function() {
    var currentSelect = $(this);
    var currentValue = currentSelect.val();

    currentSelect.find('option').each(function() {
      var optionValue = $(this).val();
      if (optionValue !== "" && selectedValues.includes(optionValue) && optionValue !== currentValue) {
        $(this).prop('disabled', true);
      } else {
        $(this).prop('disabled', false);
      }
    });
  });


  $(".gejala-wrapper").each(function(index) {
    if (index === 0) {
      $(this).find(".btn-hapus-gejala").hide();
    } else {
      $(this).find(".btn-hapus-gejala").show();
    }
  });
}

$(document).ready(function() {
  $(".btn-tambah-gejala").click(function() {
    var newDropdown = `
      <div class="form-group gejala-wrapper">
        <div class="select-wrapper">
            <select name="gejala[]" class="form-control input-lg mt-2 gejala-select">
                <option value="">Pilih Gejala</option>
                @foreach($gejala_list as $gejala)
                <option value="{{ $gejala->kode_gejala }}">{{ $gejala->nama_gejala }}</option>
                @endforeach
            </select>
        </div>
        <button type="button" class="btn btn-danger btn-hapus-gejala">Hapus</button>
      </div>`;
    $("#gejala-container").append(newDropdown);

    let newSelect = $("#gejala-container .gejala-select").last()[0];
    initChoicesOnNewSelect(newSelect);

    updateDropdownOptions();
  });

  $(document).on("click", ".btn-hapus-gejala", function() {
    if ($('.gejala-wrapper').length > 1) {
      $(this).closest(".gejala-wrapper").remove();
      updateDropdownOptions();
    }
  });

  $(document).on('change', '.gejala-select', function() {
    updateDropdownOptions();
  });

  $(".gejala-select").each(function() {
    initChoicesOnNewSelect(this);
  });

  updateDropdownOptions();
});

WP-Event-Manager Remove restrictions for submitting events

Since WP event manager did an update, it is no longer possible for logged in users with the rol ‘subscriber’ to edit their own published events. How can I commenting this line below so the restriction on event submission for subscribers will be removed?

In function.php is now writing:

// add_action(‘wp_event_manager_event_submit_before’, array($this, ‘wpem_restrict_non_organizer_access_to_dashboard’));

Prisma Client Initialization Issue After Running npx prisma generate

I’m facing an issue with Prisma Client initialization after running npx prisma generate. Here’s the error I’m encountering:

PS C:UsersUSERDataAnalytics> node Scripts/loadData.js      
[class PrismaClient]
C:UsersUSERDataAnalyticsnode_modules.prismaclientdefault.js:43
    throw new Error('@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.');
^

Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
    at new PrismaClient (C:UsersUSERDataAnalyticsnode_modules.prismaclientdefault.js:43:11)
    at Object.<anonymous> (C:UsersUSERDataAnalyticsScriptsloadData.js:5:16)
    at Module._compile (node:internal/modules/cjs/loader:1554:14)
    at Object..js (node:internal/modules/cjs/loader:1706:10)
    at Module.load (node:internal/modules/cjs/loader:1289:32)
    at Function._load (node:internal/modules/cjs/loader:1108:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
    at node:internal/main/run_main_module:36:49

Node.js v22.14.0

Load Data.js

const fs = require('fs');
const csv = require('csv-parser');
const { PrismaClient } = require('@prisma/client'); 
console.log(PrismaClient); // Added this for debugging
const prisma = new PrismaClient();  

const path = require('path');

async function ImportMatches() {
    const results = [];
    fs.createReadStream(path.join(__dirname, 'matches.csv'))
        .pipe(csv())
        .on('data', (data) => {
            results.push({
                id: parseInt(data.id),
                season: parseInt(data.season),
                date: new Date(data.date),
                team1: data.team1,
                team2: data.team2,
                // (other fields trimmed for brevity)
            });
        })
        .on('end', async () => {
            for (const match of results) {
                await prisma.match.create({ data: match });
            }
            console.log('Matches imported successfully!');
            await prisma.$disconnect();
        })
        .on('error', (error) => {
            console.error('CSV read error:', error);
        });
}

ImportMatches();

when i run npx prisma generate

 PS C:UsersUSERDataAnalytics> npx prisma generate
Environment variables loaded from .env
Prisma schema loaded from prismaschema.prisma

✔ Generated Prisma Client (v6.6.0) to .generatedprisma in 102ms

Start by importing your Prisma Client (See: https://pris.ly/d/importing-client)

Tip: Easily identify and fix slow SQL queries in your app. Optimize helps you enhance your visibility: https://pris.ly/--optimize
node Scripts/loadData.js

Things I’ve tried:

Running npx prisma generate again.

Checking node_modules/@prisma/client for the generated client.

Rebuilding node_modules by deleting node_modules and package-lock.json, then running npm install.

I’m using Node.js v22.14.0, Prisma v6.6.0, and PostgreSQL as the database.

Flipbook.js not displaying PDF pages after deployment

enter image description here

I’m using Flipbook to display a PDF in my application. Everything works perfectly on my local server — the PDF is correctly loaded, rendered, and printable.

However, when deployed to production, the PDF still loads (confirmed via dev tools), but the pages are not being displayed correctly, and printing the PDF doesn’t work. It just shows a blank or loading screen.

I suspect the issue might be related to how WebGL is handled in the deployment environment, or something about how PDF.js is rendering the document after deployment. The browser console logs a warning:
Warning: TT: undefined function: 32

Also, I noticed that even when I try to disable WebGL manually, it remains enabled:

js
Copier
Modifier
!!window.WebGLRenderingContext && !!document.createElement(‘canvas’).getContext(‘webgl’) // always returns true
I’ve tried switching to canvas rendering mode, but it seems Flipbook is still trying to use WebGL anyway.

I don’t have any error on console

enter image description here

Can’t programmatically set value in input field (credit card field) using JavaScript — setter doesn’t work

I’m working on a project using Selenium (Python) where I need to programmatically fill out a form that includes credit card input fields. However, the site prevents standard JavaScript injection methods from setting values in these inputs.
Here’s the input element I’m working with:

<input type="text" class="form-text is-wide" aria-label="Name on card" value="" maxlength="80">

And here’s the JavaScript I’ve been trying to use. Keep in mind I’ve tried a bunch of other JavaScript solutions:

(() => {
  const input = document.querySelector('input[aria-label="Name on card"]');
  if (input) {
    const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set;
    setter.call(input, 'Hello World');
    input.dispatchEvent(new Event('input', { bubbles: true }));
    input.dispatchEvent(new Event('change', { bubbles: true }));
  }
})();

This doesn’t update the field as expected. However, something strange happens: if I activate the DOM inspector (Ctrl+Shift+C), click on the element, and then re-run the same JavaScript snippet, it does work. Just clicking the input normally or trying to type manually doesn’t help.

I’m assuming the page is using some sort of script (maybe Stripe.js or another payment processor) that interferes with the regular input events.

Image of what it looks like: https://imgur.com/a/WodBrHW
How can I programmatically populate this input field in a way that mimics real user input?

React native app has trouble in debugging

recently I experienced too many issues after upgrading to RN 0.77.0
the last thing is the app cannot connect to metro, or that’s what I think. And then can’t receive any logs from my app.
Using a IOS simulator (Iphone 16 pro) IOS 18.4

Metro config (in metro.config.js)

const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');

/**
* Metro configuration for React Native
* https://reactnative.dev/docs/metro
*
* @type {import('@react-native/metro-config').MetroConfig}
*/
const config = {};
module.exports =mergeConfig(getDefaultConfig(__dirname), config); 

enter image description here

Error “isFF is not defined” when scrolling in the select tag of the antd library in react

“isFF is not defined” error when scrolling in a React project

I’m experiencing the “isFF is not defined” error when scrolling in my React project. Here’s the stack trace:

ReferenceError: isFF is not defined
    at onWheelY (http://localhost:3000/static/js/bundle.js:138223:5)
    at HTMLDivElement.onWheel (http://localhost:3000/static/js/bundle.js:138268:7)

Context

  • The project is built with React and uses antd for UI components.
  • Dependencies related to the issue:
"dependencies": {
    "antd": "^5.24.6",
    "rc-select": "^14.16.6",
    "react": "^19.1.0",
    "react-dom": "^19.1.0"
}

Minimal Reproducible Code

The error occurs when using this <Select> component inside <Form.Item>:

import React from "react";
import { Form, Select } from "antd";

const SkillsForm = () => {
    return (
        <Form>
            <Form.Item name="skills" label="Skills">
                <Select
                    mode="tags"
                    style={{ width: "100%" }}
                    placeholder="Enter skills and press Enter"
                    tokenSeparators={[","]}
                    options={[
                        { label: "JavaScript", value: "JavaScript" },
                        { label: "Python", value: "Python" }
                    ]}
                />
            </Form.Item>
        </Form>
    );
};

export default SkillsForm;

What I Have Tried

  • Updated React, Ant Design, and rc-select to the latest versions.
  • Explicitly defined isFF, but the error persists.
  • Checked rc-select for any references to isFF, but didn’t find any direct mentions.

Question

Where could isFF be coming from if I’m not using it explicitly? How can I properly fix this error?

Screenshot of the error

(https://i.sstatic.net/Gd80FdQE.png)

Any help would be greatly appreciated!

How to make public flashusdt software that individuals can use any escrow of their choice to deal and how to provide demo for free

My USDT flash software can send TRC20 and ERC20 tokens with confirmation, allowing them to be traded, swapped, or used on any platform. Transactions can last up to a year and include full transaction hashes and history. You can send amounts ranging from $5 to $2,000,000 per transaction, with no daily limits.

To ensure a secure and fair trade, we require the use of an escrow service. You can provide an escrow service that you trust, or we can guide you through our recommended two-party escrow process, which is designed to protect both parties. We will explain the process in detail before you proceed, allowing you to verify its security.
how can we reach the right audience?

Creating a Dev Script that Auto Runs and can Access the Entire Project

CONTEXT:
Code projects of any kind get more and more difficult to test during creation the bigger they get. What I mean by “test during creation” is when you run code you just wrote to see if it works how you intended and scan for errors. I’m not talking about unit testing. While some may use unit testing for this process, I typically find it less overwhelming if I do the initial tests manually.

I’m sure it’s a common issue to have to deal with login screens as a developer after you implement them, because each time you run the code, it forces you to log in again. It’s for features like this, where their existence makes testing more repetitive, that I use dev scripts.

Dev scripts are just how I refer to scripts that are self contained, ignored by git, and can access and change any code for ease of testing. This is important to distinguish because it means I have to build them with the assumption I can’t change the original code for testing.

PROBLEM:
Now for the actual issue. I’m having trouble setting up a dev script for a Nuxt website. To run it automatically without modifying old code, I placed it in the public folder and used a browser extension (User JavaScript and CSS) to auto run it if I’m on a localhost website. This works great for everything the browser has direct access to, but trying to run anything else is where it becomes a problem.

Because the public folder is treated as completely static and separate from the rest of the project, it can’t access or run anything outside of itself. I first tried to get around this by using API. By setting up an API end point file and having git ignore it, it can act as a sort of “helper” file to access the rest of the project. This works for static data objects which aren’t meant to change, but it completely crumbles when you attempt to import and run any kind of function, including full modules.

I’m positive there’s a better solution here, but I’m not experienced enough to see it. The fact that Nuxt’s API folder can gain access to entire modules is great. I’m sure there must be a way to just build most of my code there and use the original dev script to run the API script, but that’s honestly where my knowledge is most lacking.

QUESTION:
Without editing any of the original code, how would you set up a dev script for Nuxt that 1) has access to the entire project, and 2) can be auto-run when the website loads?

morejava.util.concurrent.ThreadPoolExecutor.runWorker[enter link description here[][1]][1[]][1] [closed]

at bnch.run(PG:1)

at bcrs.run(PG:1)

at

java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)

at

java.util.concurrent.ThreadPoolExecutor$Worker.ru

n(ThreadPoolExecutor.java:641)

at bcqx.run(PG:2)

at bcrd.run(PG:4)

Caused by: java.lang.NullPointerException:

getString(i++) must not be null

at java.lang.Thread.run(Thread.java:920) at bsnb.a(PG:1)

at vnb.invoke(PG:4)

at vnh.a(PG:5)

at bsnh.a(PG:2)

at bsmh.d(PG:2)

at bsmj.run(PG:9)

6 more

Caused by: vko

at vld.h(PG:1)

at vld.d(PG:1)

vnm.f(PG:6)

at vnm.d(PG:11)

at vne.cZ(PG:3)

at cbuf.o(PG:4)

at ccds.run(PG:14)

at bnch.run(PG:1)

6 more

by: vko

at vld.g(PG:3)

at vol.a(PG:4)

at bnct.run(Unknown Source:6)

at boei.run(PG:2)

6 morejava.util.concurrent.ThreadPoolExecutor.runWorker[enter link description here[][1]][1]enter link description herehttps://

How to automate the order according to the razorpay payment status

So I am making a webapp integrating the razorpay’s payment gateway,
I am not able to identify why is the order being when I click these

This is Cancel Button on the Razorpay’s popup

This is the button to Confirm Cancel the Payment

when I click here technically the payment is unsuccessful but still the order is being sent, which I could not find a solution for.

especially, when a payment is unsuccessful or cancelled order should not placed.

I tried For the Payment status but still could not achieve the feature to actually not send the order details until the payment is done or successful.

This is how my order controller looks

const placeOrder = async (req, res) => {
    try {
        const { userId, items, amount, address, color } = req.body


        const orderData = {
            userId,
            items,
            address,
            amount,
            paymentMethod: "COD",
            payment: false,
            date: Date.now()
        }
        console.log(orderData)
        const newOrder = new orderModel(orderData)
        await newOrder.save()
        await userModel.findByIdAndUpdate(userId, { cartData: {} })

        res.json({ success: true, message: "Order Placed" })
    } catch (error) {
        console.log(error)
        res.json({ success: false, message: error.message })
    }
}

// Create Razorpay Order
const placeOrderRazorpay = async (req, res) => {
  try {
    const { userId, items, amount, address } = req.body;

    const newOrder = new orderModel({
      userId,
      items,
      address,
      amount,
      paymentMethod: "Razorpay",
      payment: false, // Payment status is false initially
      date: Date.now(),
    });

    await newOrder.save();

    const options = {
      amount: amount * 100, // Amount in paise (Razorpay expects paise)
      currency: "INR",
      receipt: newOrder._id.toString(), // This will be used later to identify the order
    };

    razorpayInstance.orders.create(options, (err, order) => {
      if (err) {
        console.log(err);
        return res.json({ success: false, message: "Failed to create Razorpay order" });
      }
      res.json({ success: true, order });
    });
  } catch (error) {
    console.log(error);
    res.json({ success: false, message: error.message });
  }
};

// Verify Razorpay Payment
const verifyRazorpay = async (req, res) => {
  try {
    const { razorpay_order_id, razorpay_payment_id, razorpay_signature, userId } = req.body;

    // Generate the Razorpay signature from the server-side
    const generated_signature = crypto
      .createHmac("sha256", process.env.RAZORPAY_KEY_SECRET)
      .update(razorpay_order_id + "|" + razorpay_payment_id)
      .digest("hex");

    // Check if the signature matches
    if (generated_signature !== razorpay_signature) {
      return res.json({ success: false, message: "Invalid signature" });
    }

    // Update the order to indicate payment has been completed
    const updatedOrder = await orderModel.findByIdAndUpdate(
      razorpay_order_id,
      { payment: true }, // Mark payment as true
      { new: true }
    );

    if (!updatedOrder) {
      return res.json({ success: false, message: "Order not found" });
    }

    // Clear the user's cart data upon successful payment
    await userModel.findByIdAndUpdate(userId, { cartData: {} });

    res.json({ success: true, message: "Payment verified successfully" });
  } catch (error) {
    console.log(error);
    res.json({ success: false, message: error.message });
  }
};

This is how I am handling the verify payment in my frontend

const Verify = () => {
  const {
    navigate,
    token,
    backendUrl,
    user,
    setCartItems,
  } = useContext(ShopContext);

  const [searchParams] = useSearchParams();
  const razorpay_order_id = searchParams.get("order_id");
  const razorpay_payment_id = searchParams.get("razorpay_payment_id");
  const razorpay_signature = searchParams.get("razorpay_signature");

  const [loading, setLoading] = useState(false);

  const verifyPayment = async () => {
    if (!razorpay_order_id || !razorpay_payment_id || !razorpay_signature || !user._id) {
      toast.error("Payment details are incomplete.");
      setTimeout(() => navigate("/place-order"), 5000);
      return;
    }

    try {
      setLoading(true); // Start loading

      const res = await axios.post(
        `${backendUrl}/api/order/verifyRazorpay`,
        {
          razorpay_order_id,
          razorpay_payment_id,
          razorpay_signature,
          userId: user._id,
        },
        {
          headers: { token },
        }
      );

      if (res.data.success) {
        toast.success("Payment successful!");
        setCartItems({}); // Clear cart after successful payment
        setTimeout(() => navigate("/cart"), 3000); // Navigate to cart page after success
      } else {
        toast.error("Payment failed. If money was deducted, contact support.");
        setTimeout(() => navigate("/place-order"), 7000); // Redirect back to place order page if payment fails
      }
    } catch (err) {
      console.log(err);
      toast.error("Verification error. Try again.");
      setTimeout(() => navigate("/place-order"), 7000); // Redirect back to place order page in case of an error
    } finally {
      setLoading(false); // Stop loading
    }
  };

  useEffect(() => {
    if (razorpay_payment_id && razorpay_signature && razorpay_order_id && token) {
      verifyPayment(); // Verify payment if the necessary params are present
    } else {
      toast.error("Payment not completed.");
      setTimeout(() => navigate("/place-order"), 5000); // Redirect if payment details are not valid
    }
  }, [razorpay_payment_id, razorpay_signature, razorpay_order_id, token]);

Any help regrading this is really appreciated Thank you.