@@ -5,6 +5,8 @@ import { actionCreators as profileActions } from 'store/modules/profile';
5
5
import { actionCreators as listingActions } from 'store/modules/listing' ;
6
6
import { actionCreators as commonActions } from 'store/modules/common' ;
7
7
import { actionCreators as followActions } from 'store/modules/follow' ;
8
+ import { actionCreators as seriesActions } from 'store/modules/series' ;
9
+
8
10
import { bindActionCreators } from 'redux' ;
9
11
import type { State } from 'store' ;
10
12
import { type Match } from 'react-router' ;
@@ -154,6 +156,43 @@ const routes = [
154
156
} ,
155
157
stop : true ,
156
158
} ,
159
+ {
160
+ path : '/@:username/series/:urlSlug' ,
161
+ preload : async ( ctx : any , { dispatch, getState } : any , match : Match ) => {
162
+ const SeriesActions = bindActionCreators ( seriesActions , dispatch ) ;
163
+ const { username, urlSlug } = match . params ;
164
+ if ( ! username || ! urlSlug ) return null ;
165
+ return SeriesActions . getSeries ( {
166
+ username,
167
+ urlSlug,
168
+ } ) ;
169
+ } ,
170
+ stop : true ,
171
+ } ,
172
+ {
173
+ path : '/@:username/series' ,
174
+ exact : true ,
175
+ preload : async ( ctx : any , { dispatch, getState } : any , match : Match ) => {
176
+ const { username } = match . params ;
177
+ const ProfileActions = bindActionCreators ( profileActions , dispatch ) ;
178
+ const FollowActions = bindActionCreators ( followActions , dispatch ) ;
179
+ if ( ! username ) return null ;
180
+ ProfileActions . setSideVisibility ( false ) ;
181
+ await Promise . all ( [
182
+ ProfileActions . getProfile ( username ) ,
183
+ ProfileActions . getSeriesList ( username ) ,
184
+ ] ) ;
185
+ const state : State = getState ( ) ;
186
+ const { profile } = state . profile ;
187
+ if ( profile ) {
188
+ if ( ctx . state . logged ) {
189
+ await FollowActions . getUserFollow ( profile . id ) ;
190
+ }
191
+ }
192
+ return Promise . resolve ( ) ;
193
+ } ,
194
+ stop : true ,
195
+ } ,
157
196
{
158
197
path : '/@:username/:urlSlug' ,
159
198
component : Post ,
0 commit comments