From b710f63a03c16c9034ea097b7542217e85b73c85 Mon Sep 17 00:00:00 2001 From: Anand Suthar Date: Sun, 16 Jun 2024 23:37:50 +0530 Subject: [PATCH] Completed functionality for updating profile picture --- app/(pages)/patient/components/ProfileSettings/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/(pages)/patient/components/ProfileSettings/index.tsx b/app/(pages)/patient/components/ProfileSettings/index.tsx index 6b52fc6e..10141013 100644 --- a/app/(pages)/patient/components/ProfileSettings/index.tsx +++ b/app/(pages)/patient/components/ProfileSettings/index.tsx @@ -9,7 +9,7 @@ import { Tooltip, DatePicker, } from "@nextui-org/react"; -import { CldUploadWidget } from "next-cloudinary"; +import { CldUploadWidget, CloudinaryUploadWidgetInfo } from "next-cloudinary"; import Image from "next/image"; import React, { type ChangeEvent, useRef, useState, useEffect } from "react"; import { AiTwotoneEye, AiOutlineEyeInvisible } from "react-icons/ai"; @@ -286,9 +286,10 @@ export default function ProfileSettings({ patient }: { patient: Patient }) { { + const info = result.info as CloudinaryUploadWidgetInfo; const res = await fetch("/api/patient/update-profile/profile", { - method:"PUT", - body: JSON.stringify(result.info), + method: "PUT", + body: JSON.stringify(info.secure_url), }); const isProfileUpdated = await res.json();