forked from org-roam/org-roam-ui
/
uniorg.tsx.patch
34 lines (33 loc) · 998 Bytes
/
uniorg.tsx.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- /media/user01/data/lab/org-roam-ui/util/uniorg.tsx 2022-04-09 16:54:32.484871707 +0200
+++ ./util/uniorg.tsx 2022-04-09 15:54:35.389147348 +0200
@@ -36,18 +36,21 @@
const id = encodeURIComponent(encodeURIComponent(previewNode.id))
useEffect(() => {
- fetch(`http://localhost:35901/node/${id}`)
- .then((res) => {
- return res.text()
+ fetch(`notes/${id}`)
+ .then((res) => {
+ if(res.ok)
+ return res.text()
+ else
+ return null
})
.then((res) => {
- if (res === '') {
- return '(empty node)'
- }
- if (res !== 'error') {
- console.log(res)
- setPreviewText(res)
- }
+ if (res) {
+ if (res === '')
+ return '(empty node)'
+ else
+ setPreviewText(res)
+ }else
+ setPreviewText('')
})
.catch((e) => {
setPreviewText('(could not find node)')