- Timestamp:
- 02/07/26 15:15:12 (5 months ago)
- Branches:
- main
- Children:
- dc30259
- Parents:
- 5938bc9
- Location:
- frontend/src
- Files:
-
- 3 edited
-
App.tsx (modified) (1 diff)
-
pages/Nav.tsx (modified) (1 diff)
-
pages/UserDetail.tsx (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
frontend/src/App.tsx
r5938bc9 rebdd3d4 90 90 element: <MusicalCollection />, 91 91 }, 92 { 93 path: "/me", 94 element: <UserDetail />, 95 }, 92 96 ], 93 97 }, -
frontend/src/pages/Nav.tsx
r5938bc9 rebdd3d4 105 105 <div className="absolute right-0 mt-2 w-48 bg-gray-700 rounded-lg shadow-lg py-1 z-50"> 106 106 <Link 107 to=" #"107 to="/me" 108 108 className="block px-4 py-2 text-sm text-white hover:bg-gray-600 transition-colors" 109 109 onClick={() => setIsDropdownOpen(false)} -
frontend/src/pages/UserDetail.tsx
r5938bc9 rebdd3d4 5 5 import ListenerView from "../components/userProfile/ListenerView"; 6 6 import UserListModal from "../components/userProfile/UserListModal"; 7 import { useAuth } from "../context/authContext"; 7 8 import { handleError } from "../utils/error"; 8 9 import type { … … 35 36 // user refers to the selected user NOT to the user from context 36 37 const baseURL = import.meta.env.VITE_API_BASE_URL; 37 const { username } = useParams(); 38 const { username: usernameParam } = useParams(); 39 // sintaksava dole znaci zemi go user od auth context i preimenuvaj go vo currentUser, za da ne se izmesa so user-ot dole 40 const { user: currentUser } = useAuth(); 38 41 const navigate = useNavigate(); 39 42 const [user, setUser] = useState<UserProfile | null>(null); … … 44 47 const [isLoadingModal, setIsLoadingModal] = useState(false); 45 48 const [isFollowing, setIsFollowing] = useState(false); 49 50 // determine which username to use: URL param or current user's username 51 const username = usernameParam || currentUser?.username; 52 53 // if we're on /me route and no user is logged in, show error 54 if (!usernameParam && !currentUser) { 55 return ( 56 <div className="p-6 bg-red-50 border border-red-200 text-red-700 rounded-lg"> 57 <h2 className="font-bold">Authentication Required</h2> 58 <p>You must be logged in to view your profile.</p> 59 <button 60 onClick={() => navigate("/login")} 61 className="mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors duration-200 cursor-pointer" 62 > 63 Go to Login 64 </button> 65 </div> 66 ); 67 } 46 68 47 69 const handleFollow = async () => {
Note:
See TracChangeset
for help on using the changeset viewer.
