From 8651423349274b0a9188f6768b63273345da138b Mon Sep 17 00:00:00 2001 From: Piyush Saini <134310734+piyushhsainii@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:45:14 +0530 Subject: [PATCH] optimised the code --- src/components/userDetails.tsx | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/components/userDetails.tsx b/src/components/userDetails.tsx index 261d874e..ffa8ab69 100644 --- a/src/components/userDetails.tsx +++ b/src/components/userDetails.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { Input } from './ui/input'; import { Button } from './ui/button'; -import { toast, useToast } from './ui/use-toast'; +import { useToast } from './ui/use-toast'; import axios from "axios" const UserDetails = () => { @@ -12,13 +12,13 @@ const UserDetails = () => { const [github, setGithub] = useState("https://github.com/code100x/job-board") const [linkedIn, setLinkedIn] = useState("https://www.linkedin.com/in/kirat-li/") const [twitter, setTwitter] = useState("https://x.com/kirat_tw") - const [Lpa, setLpa] = useState(12) + const [Lpa, setLpa] = useState(12) const { toast } = useToast() const [resumeFile, setResumeFile] = useState(null) const [isResumeUploading, setisResumeUploading] = useState(false) const uploadResume = async () => { - if (resumeFile == null) { + if (resumeFile === null) { return toast({ description: "Please add file first", variant: "destructive" @@ -38,7 +38,6 @@ const UserDetails = () => { 'Content-Type': 'multipart/form-data' } }); - console.log(response) setisResumeUploading(false) toast({ description: "File uploaded successfully!", @@ -54,15 +53,6 @@ const UserDetails = () => { } } - // const handleFileChange = async (e: any) => { - // const selectedFile = e.target.files[0]; - // const reader = new FileReader(); - - // reader.readAsDataURL(selectedFile); - // if (selectedFile) { - // setResumeFile(selectedFile); - // } - // }; const handleFileChange = (e: React.ChangeEvent) => { if (e.target.files && e.target.files[0]) { setResumeFile(e.target.files[0]); @@ -82,17 +72,17 @@ const UserDetails = () => {
- - + { setFirstName(e.target.value) }} /> + { setLastName(e.target.value) }} />
- + { setGithub(e.target.value) }} />
- + { setLinkedIn(e.target.value) }} />
- + { setTwitter(e.target.value) }} />
@@ -108,7 +98,7 @@ const UserDetails = () => {
- + { setLpa(e.target.value) }} className="max-w-[135px]" />
Expected LPA