aboutsummaryrefslogtreecommitdiff
path: root/vnext/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-10-28 14:05:47 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:58 +0300
commit06d14f94a998ef795c52e7950e5cc8828464ae8e (patch)
treedc4f159e5b56d53c7748db0ad5202c605f8df6ec /vnext/src
parentd30ed659de70a2cd833a18c02005b5c9a3b84bd8 (diff)
Handle profile errors
Diffstat (limited to 'vnext/src')
-rw-r--r--vnext/src/api/index.js11
-rw-r--r--vnext/src/ui/Thread.js8
-rw-r--r--vnext/src/ui/UserInfo.js11
3 files changed, 22 insertions, 8 deletions
diff --git a/vnext/src/api/index.js b/vnext/src/api/index.js
index aa0ddc6e..a6a6208c 100644
--- a/vnext/src/api/index.js
+++ b/vnext/src/api/index.js
@@ -71,10 +71,13 @@ const client = axios.create({
baseURL: apiBaseUrl
});
client.interceptors.request.use(config => {
- let cookies = new Cookies();
- config.params = Object.assign(config.params || {}, {
- hash: cookies.get('hash')
- });
+ if (config.url.startsWith('/')) {
+ // only local URLs
+ let cookies = new Cookies();
+ config.params = Object.assign(config.params || {}, {
+ hash: cookies.get('hash')
+ });
+ }
return config;
});
diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js
index 4982daed..b5a855f9 100644
--- a/vnext/src/ui/Thread.js
+++ b/vnext/src/ui/Thread.js
@@ -7,6 +7,7 @@ import Spinner from './Spinner';
import Avatar from './Avatar';
import { UserLink } from './UserInfo';
import Button from './Button';
+import defaultAvatar from '../assets/av-96.png';
import { format, embedUrls } from '../utils/embed';
@@ -58,6 +59,13 @@ function Comment({ msg, draft, visitor, active, setActive, onStartEditing, postC
uri: author.uri
});
}
+ }).catch(e => {
+ setAuthor({
+ uid: 0,
+ uname: userRef.current.uri,
+ uri: author.uri,
+ avatar: defaultAvatar
+ });
});
}
return () => {
diff --git a/vnext/src/ui/UserInfo.js b/vnext/src/ui/UserInfo.js
index 9239c58c..2a0ba619 100644
--- a/vnext/src/ui/UserInfo.js
+++ b/vnext/src/ui/UserInfo.js
@@ -1,12 +1,10 @@
import { memo, useState, useEffect, useRef } from 'react';
import { Link } from 'react-router-dom';
-import { info, fetchUserUri, update } from '../api';
+import { info, fetchUserUri } from '../api';
import Avatar from './Avatar';
import Icon from './Icon';
-import SearchBox from './SearchBox';
-// @ts-ignore
import defaultAvatar from '../assets/av-96.png';
import './UserInfo.css';
@@ -110,7 +108,12 @@ export function UserLink(props) {
});
}
}).catch(reason => {
- // TODO: debug logging
+ setUser({
+ uid: 0,
+ uname: userRef.current.uri,
+ uri: userRef.current.uri,
+ avatar: defaultAvatar
+ });
});
}
return () => {