Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit bcec01f

Browse files
committed
fix(router): user page subPath
1 parent 9bcfc41 commit bcec01f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pages/user.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
makeGQClient,
1414
queryStringToJSON,
1515
nilOrEmpty,
16-
getSubPath,
16+
parseURL,
1717
pagedFilter,
1818
ssrAmbulance,
1919
parseTheme,
@@ -47,7 +47,8 @@ async function fetchData(props, opt) {
4747
const token = realname ? getJwtToken(props) : null
4848
const gqClient = makeGQClient(token)
4949
const userHasLogin = nilOrEmpty(token) === false
50-
const login = R.toLower(getSubPath(props))
50+
const { subPath } = parseURL(props)
51+
const login = R.toLower(subPath)
5152

5253
const sessionState = gqClient.request(P.sessionState)
5354
const user = gqClient.request(P.user, { login, userHasLogin })
@@ -69,6 +70,7 @@ export default class UserPage extends React.Component {
6970
const { asPath } = props
7071

7172
const query = queryStringToJSON(asPath)
73+
const { subPath } = parseURL(props)
7274

7375
let resp
7476
try {
@@ -77,7 +79,7 @@ export default class UserPage extends React.Component {
7779
if (ssrAmbulance.hasLoginError(errors)) {
7880
resp = await fetchData(props, { realname: false })
7981
} else {
80-
return { statusCode: 404, target: getSubPath(props) }
82+
return { statusCode: 404, target: subPath }
8183
}
8284
}
8385

0 commit comments

Comments
 (0)