- Timestamp:
- 01/27/26 14:40:17 (6 months ago)
- Branches:
- main
- Children:
- c1d2f07
- Parents:
- 3238007
- Location:
- frontend/src
- Files:
-
- 2 edited
-
api/axiosInstance.ts (modified) (1 diff)
-
pages/Register.tsx (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
frontend/src/api/axiosInstance.ts
r3238007 r16aed54 70 70 [401, 403].includes(error.response?.status) && 71 71 !originalConfig._retry && 72 originalConfig.url !== "/auth/refresh" 72 originalConfig.url !== "/auth/refresh" && 73 originalConfig.url !== "/auth/login" && 74 originalConfig.url !== "/auth/register" 73 75 ) { 74 76 originalConfig._retry = true; -
frontend/src/pages/Register.tsx
r3238007 r16aed54 28 28 }, [previewProfilePhoto]); 29 29 30 const handleRemoveFile = () => { 31 if (previewProfilePhoto) { 32 URL.revokeObjectURL(previewProfilePhoto); 33 } 34 setProfilePhotoFile(null); 35 setPreviewProfilePhoto(null); 36 }; 37 30 38 const handleRegister = async (e: React.FormEvent) => { 31 39 e.preventDefault(); 32 40 if (profilePhotoFile && profilePhotoFile.size > 5 * 1024 * 1024) { 33 41 alert("Max file size is 5MB"); 42 return; 43 } 44 45 if (username === "" || password === "" || fullname === "" || email === "") { 46 setError("Please fill in all required fields."); 34 47 return; 35 48 } … … 56 69 toast.success("Registration successful!"); 57 70 } catch (error: any) { 58 const errorMessage = 59 error.response?.data?.error || "Registration failed. Please try again."; 71 const errorMessage = error.response?.data?.error || "Please try again."; 60 72 setError(`Registration failed: ${errorMessage}`); 61 73 } … … 65 77 <div className="flex flex-col items-center justify-center min-h-[90vh] bg-gray-100"> 66 78 <h2 className="text-2xl mb-4">Register</h2> 67 <form className="bg-white p-6 rounded shadow-md w- 80">79 <form className="bg-white p-6 rounded shadow-md w-full max-w-md"> 68 80 {error && <p className="text-red-500 mb-4">{error}</p>} 69 81 <div className="mb-4"> … … 120 132 <label 121 133 htmlFor="profilePhoto" 122 className="px-4 py-2 bg-blue-500 text-white rounded cursor-pointer hover:bg-blue-600 transition-colors text-sm font-medium "134 className="px-4 py-2 bg-blue-500 text-white rounded cursor-pointer hover:bg-blue-600 transition-colors text-sm font-medium text-center" 123 135 > 124 136 Choose File 125 137 </label> 126 <span className="text-gray-600 text-sm ">138 <span className="text-gray-600 text-sm flex-1"> 127 139 {profilePhotoFile ? profilePhotoFile.name : "No file chosen"} 128 140 </span> 141 {profilePhotoFile && ( 142 <button 143 type="button" 144 onClick={handleRemoveFile} 145 className="px-3 py-2 bg-red-500 text-white rounded hover:bg-red-600 transition-colors text-sm font-medium" 146 > 147 Remove 148 </button> 149 )} 129 150 </div> 130 151 <input
Note:
See TracChangeset
for help on using the changeset viewer.
