Write on the margins of the internet. Powered by the AT Protocol. margin.at
extension web atproto comments

Redirect to current user's profile if no did is present

seth.computer 18586330 453c5db8

verified
+6 -1
+1
web/src/App.jsx
··· 43 43 <Route path="/bookmarks" element={<Bookmarks />} /> 44 44 <Route path="/highlights" element={<Highlights />} /> 45 45 <Route path="/notifications" element={<Notifications />} /> 46 + <Route path="/profile" element={<Profile />} /> 46 47 <Route path="/profile/:handle" element={<Profile />} /> 47 48 <Route path="/login" element={<Login />} /> 48 49 <Route path="/at/:did/:rkey" element={<AnnotationDetail />} />
+5 -1
web/src/pages/Profile.jsx
··· 1 1 import { useState, useEffect } from "react"; 2 - import { useParams } from "react-router-dom"; 2 + import { useParams, Navigate } from "react-router-dom"; 3 3 import AnnotationCard, { HighlightCard } from "../components/AnnotationCard"; 4 4 import BookmarkCard from "../components/BookmarkCard"; 5 5 import { getLinkIconType, formatUrl } from "../utils/formatting"; ··· 79 79 const [showEditModal, setShowEditModal] = useState(false); 80 80 81 81 const isOwnProfile = user && (user.did === handle || user.handle === handle); 82 + 83 + if (!handle) { 84 + return <Navigate to={user ? `/profile/${user.did}` : "/login"} replace />; 85 + } 82 86 83 87 useEffect(() => { 84 88 async function fetchProfile() {