Skip to content

Commit

Permalink
Completed functionality for updating profile picture
Browse files Browse the repository at this point in the history
  • Loading branch information
ad956 committed Jun 16, 2024
1 parent 27a2a42 commit b710f63
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/(pages)/patient/components/ProfileSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -286,9 +286,10 @@ export default function ProfileSettings({ patient }: { patient: Patient }) {
<CldUploadWidget
signatureEndpoint="/api/cloudinary/sign-image"
onSuccess={async (result) => {
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();
Expand Down

0 comments on commit b710f63

Please sign in to comment.