()
| 149 | } |
| 150 | |
| 151 | _fetchCover() { |
| 152 | const { coverpage, requestHeaders } = this.config; |
| 153 | const query = this.route.query; |
| 154 | const root = getParentPath(this.route.path); |
| 155 | |
| 156 | if (coverpage) { |
| 157 | let path = null; |
| 158 | const routePath = this.route.path; |
| 159 | if (typeof coverpage === 'string') { |
| 160 | if (routePath === '/') { |
| 161 | path = coverpage; |
| 162 | } |
| 163 | } else if (Array.isArray(coverpage)) { |
| 164 | path = coverpage.indexOf(routePath) > -1 && '_coverpage'; |
| 165 | } else { |
| 166 | const cover = coverpage[routePath]; |
| 167 | path = cover === true ? '_coverpage' : cover; |
| 168 | } |
| 169 | |
| 170 | const coverOnly = Boolean(path) && this.config.onlyCover; |
| 171 | if (path) { |
| 172 | path = this.router.getFile(root + path); |
| 173 | this.coverIsHTML = /\.html$/g.test(path); |
| 174 | get(path + stringifyQuery(query, ['id']), false, requestHeaders).then( |
| 175 | text => this._renderCover(text, coverOnly) |
| 176 | ); |
| 177 | } else { |
| 178 | this._renderCover(null, coverOnly); |
| 179 | } |
| 180 | |
| 181 | return coverOnly; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | $fetch(cb = noop, $resetEvents = this.$resetEvents.bind(this)) { |
| 186 | const done = () => { |
no test coverage detected