@@ -6,27 +6,12 @@ import NextSeo from 'next-seo'
6
6
import { PAGE_SIZE , SITE_URL } from '@config'
7
7
import initRootStore from '@stores/init'
8
8
9
- import AnalysisService from '@services/Analysis'
10
- import GlobalLayout from '@containers/GlobalLayout'
11
- import ThemeWrapper from '@containers/ThemeWrapper'
12
- import MultiLanguage from '@containers/MultiLanguage'
13
- import Sidebar from '@containers/Sidebar'
14
- import Preview from '@containers/Preview'
15
- import Doraemon from '@containers/Doraemon'
16
- import Route from '@containers/Route'
17
- import Header from '@containers/Header'
18
- import CommunityBanner from '@containers/CommunityBanner'
19
- import CommunityContent from '@containers/CommunityContent'
20
- import Footer from '@containers/Footer'
21
- import ErrorBox from '@containers/ErrorBox'
22
- import ErrorPage from '@components/ErrorPage'
23
-
24
9
import {
10
+ isServerSide ,
25
11
getJwtToken ,
26
12
makeGQClient ,
27
13
queryStringToJSON ,
28
- getMainPath ,
29
- getSubPath ,
14
+ parseURL ,
30
15
akaTranslate ,
31
16
extractThreadFromPath ,
32
17
buildLog ,
@@ -40,6 +25,21 @@ import {
40
25
parseTheme ,
41
26
} from '@utils'
42
27
28
+ import AnalysisService from '@services/Analysis'
29
+ import GlobalLayout from '@containers/GlobalLayout'
30
+ import ThemeWrapper from '@containers/ThemeWrapper'
31
+ import MultiLanguage from '@containers/MultiLanguage'
32
+ import Sidebar from '@containers/Sidebar'
33
+ import Preview from '@containers/Preview'
34
+ import Doraemon from '@containers/Doraemon'
35
+ import Route from '@containers/Route'
36
+ import Header from '@containers/Header'
37
+ import CommunityBanner from '@containers/CommunityBanner'
38
+ import CommunityContent from '@containers/CommunityContent'
39
+ import Footer from '@containers/Footer'
40
+ import ErrorBox from '@containers/ErrorBox'
41
+ import ErrorPage from '@components/ErrorPage'
42
+
43
43
import { P } from '@schemas'
44
44
45
45
/* eslint-disable-next-line */
@@ -59,10 +59,8 @@ async function fetchData(props, opt) {
59
59
const { asPath} = props
60
60
// schema
61
61
62
- // utils: filter, tags staff
63
- const mainPath = getMainPath ( props )
62
+ const { mainPath, subPath :topic } = parseURL ( props )
64
63
const community = akaTranslate ( mainPath )
65
- const topic = getSubPath ( props )
66
64
const thread = extractThreadFromPath ( props )
67
65
68
66
let filter = addTopicIfNeed (
@@ -107,8 +105,9 @@ async function fetchData(props, opt) {
107
105
108
106
export default class CommunityPage extends React . Component {
109
107
static async getInitialProps ( props ) {
110
- const mainPath = getMainPath ( props )
111
- const subPath = getSubPath ( props )
108
+ if ( ! isServerSide ( ) ) return { }
109
+
110
+ const { mainPath, subPath} = parseURL ( props )
112
111
const thread = extractThreadFromPath ( props )
113
112
114
113
let resp