diff options
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/App.js | 2 | ||||
-rw-r--r-- | vnext/src/api/index.js | 11 | ||||
-rw-r--r-- | vnext/src/ui/UserInfo.js | 9 |
3 files changed, 8 insertions, 14 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js index f20d8db3..b14e50ab 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -13,7 +13,7 @@ import Header from './ui/Header' import Post from './ui/Post' import Thread from './ui/Thread' -import { loginUrl, me, trends } from './api' +import { me, trends } from './api' import { useVisitor } from './ui/VisitorContext' import Avatar from './ui/Avatar' import { Toaster } from 'react-hot-toast' diff --git a/vnext/src/api/index.js b/vnext/src/api/index.js index 7cb56c0e..095e18b8 100644 --- a/vnext/src/api/index.js +++ b/vnext/src/api/index.js @@ -71,8 +71,7 @@ const apiBaseUrl = 'https://beta.juick.com' const client = axios.create({ - baseURL: apiBaseUrl, - withCredentials: true + baseURL: apiBaseUrl }) /** @@ -225,10 +224,10 @@ export function fetchUserUri(profileUrl) { if (profileCache[profileUrl]) { resolve(profileCache[profileUrl]) } else { - client.get(profileUrl, { - headers: { - 'Accept': 'application/ld+json' - } + let data = new FormData() + data.append('uri', profileUrl) + client.post('/api/u/', data, { + withCredentials: false }).then(response => { profileCache[profileUrl] = response.data resolve(response.data) diff --git a/vnext/src/ui/UserInfo.js b/vnext/src/ui/UserInfo.js index f71dfcdc..3ea78d6f 100644 --- a/vnext/src/ui/UserInfo.js +++ b/vnext/src/ui/UserInfo.js @@ -97,12 +97,7 @@ export function UserLink(props) { if (userRef.current.uri) { fetchUserUri(userRef.current.uri).then(remote_user => { if (isMounted) { - setUser({ - uid: 0, - uname: remote_user.preferredUsername, - avatar: remote_user.icon && remote_user.icon.url, - uri: userRef.current.uri - }) + setUser(remote_user) } }).catch(() => { setUser({ @@ -122,7 +117,7 @@ export function UserLink(props) { <Link key={user.uid} to={`/${user.uname}/`} className="info-avatar"> <img src={user.avatar} />{user.uname} </Link> - : <a href={user.uri} className="info-avatar"> + : <a href={user.url || user.uri} className="info-avatar"> <img src={user.avatar || defaultAvatar} />{user.uname} </a> ) |