tangled
alpha
login
or
join now
margin.at
/
margin
86
fork
atom
Write on the margins of the internet. Powered by the AT Protocol.
margin.at
extension
web
atproto
comments
86
fork
atom
overview
issues
4
pulls
1
pipelines
Redirect to current user's profile if no did is present
seth.computer
1 month ago
18586330
453c5db8
verified
This commit was signed with the committer's
known signature
.
seth.computer
SSH Key Fingerprint:
SHA256:utUtG8j2hgvZ0Rnm/rPJiqFu4NT5bjOnC26AUIBh500=
+6
-1
2 changed files
expand all
collapse all
unified
split
web
src
App.jsx
pages
Profile.jsx
+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
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
2
-
import { useParams } from "react-router-dom";
2
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
82
+
83
83
+
if (!handle) {
84
84
+
return <Navigate to={user ? `/profile/${user.did}` : "/login"} replace />;
85
85
+
}
82
86
83
87
useEffect(() => {
84
88
async function fetchProfile() {