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
lint
scanash.com
1 month ago
35352b49
64f3aa46
+20
-18
1 changed file
expand all
collapse all
unified
split
web
src
components
modals
EditHistoryModal.tsx
+20
-18
web/src/components/modals/EditHistoryModal.tsx
···
19
19
const [error, setError] = useState<string | null>(null);
20
20
21
21
useEffect(() => {
22
22
+
const fetchHistory = async () => {
23
23
+
if (!item.uri) return;
24
24
+
25
25
+
try {
26
26
+
setLoading(true);
27
27
+
setError(null);
28
28
+
const res = await fetch(
29
29
+
`/api/annotations/history?uri=${encodeURIComponent(item.uri)}`,
30
30
+
);
31
31
+
if (!res.ok) throw new Error("Failed to fetch history");
32
32
+
const data = await res.json();
33
33
+
setHistory(data);
34
34
+
} catch (err) {
35
35
+
console.error(err);
36
36
+
setError("Failed to load edit history");
37
37
+
} finally {
38
38
+
setLoading(false);
39
39
+
}
40
40
+
};
41
41
+
22
42
if (isOpen && item.uri) {
23
43
fetchHistory();
24
44
document.body.style.overflow = "hidden";
···
27
47
document.body.style.overflow = "unset";
28
48
};
29
49
}, [isOpen, item.uri]);
30
30
-
31
31
-
const fetchHistory = async () => {
32
32
-
try {
33
33
-
setLoading(true);
34
34
-
setError(null);
35
35
-
const res = await fetch(
36
36
-
`/api/annotations/history?uri=${encodeURIComponent(item.uri)}`,
37
37
-
);
38
38
-
if (!res.ok) throw new Error("Failed to fetch history");
39
39
-
const data = await res.json();
40
40
-
setHistory(data);
41
41
-
} catch (err) {
42
42
-
console.error(err);
43
43
-
setError("Failed to load edit history");
44
44
-
} finally {
45
45
-
setLoading(false);
46
46
-
}
47
47
-
};
48
50
49
51
if (!isOpen) return null;
50
52