File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed
Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ export function Fetch(Base) {
150150 }
151151 }
152152
153- _fetchCover ( ) {
153+ _fetchCover ( cb = noop ) {
154154 const { coverpage, requestHeaders } = this . config ;
155155 const query = this . route . query ;
156156 const root = getParentPath ( this . route . path ) ;
@@ -174,13 +174,17 @@ export function Fetch(Base) {
174174 path = this . router . getFile ( root + path ) ;
175175 this . coverIsHTML = / \. h t m l $ / g. test ( path ) ;
176176 get ( path + stringifyQuery ( query , [ 'id' ] ) , false , requestHeaders ) . then (
177- text => this . _renderCover ( text , coverOnly )
177+ text => {
178+ this . _renderCover ( text , coverOnly ) ;
179+ cb ( coverOnly ) ;
180+ }
178181 ) ;
179182 } else {
180183 this . _renderCover ( null , coverOnly ) ;
184+ cb ( coverOnly ) ;
181185 }
182-
183- return coverOnly ;
186+ } else {
187+ cb ( false ) ;
184188 }
185189 }
186190
@@ -190,16 +194,16 @@ export function Fetch(Base) {
190194 cb ( ) ;
191195 } ;
192196
193- const onlyCover = this . _fetchCover ( ) ;
194-
195- if ( onlyCover ) {
196- done ( ) ;
197- } else {
198- this . _fetch ( ( ) => {
199- onNavigate ( ) ;
197+ this . _fetchCover ( onlyCover => {
198+ if ( onlyCover ) {
200199 done ( ) ;
201- } ) ;
202- }
200+ } else {
201+ this . _fetch ( ( ) => {
202+ onNavigate ( ) ;
203+ done ( ) ;
204+ } ) ;
205+ }
206+ } ) ;
203207 }
204208
205209 _fetchFallbackPage ( path , qs , cb = noop ) {
You can’t perform that action at this time.
0 commit comments