|
108 | 108 | </div> |
109 | 109 | <script> |
110 | 110 | const RustfmtTagsUrl = 'https://api.github.com/repos/rust-lang/rustfmt/tags'; |
111 | | - const RustfmtLatestUrl = 'https://api.github.com/repos/rust-lang/rustfmt/releases/latest'; |
112 | 111 | const UrlHash = window.location.hash.replace(/^#/, ''); |
113 | 112 | const queryParams = new URLSearchParams(window.location.search); |
114 | 113 | const searchParam = queryParams.get('search'); |
|
134 | 133 | scrolledOnce: false, |
135 | 134 | }, |
136 | 135 | asyncComputed: { |
137 | | - async updateVersion() { |
138 | | - let latest; |
139 | | - try { |
140 | | - latest = (await axios.get(RustfmtLatestUrl)).data; |
141 | | - } catch(err) { |
142 | | - console.log(err); |
143 | | - return; |
144 | | - } |
145 | | - if (versionParam == null) { |
146 | | - this.viewVersion = latest.name; |
147 | | - } |
148 | | - }, |
| 136 | + async pullTags() { |
| 137 | + let tags; |
| 138 | + try { |
| 139 | + tags = (await axios.get(RustfmtTagsUrl)).data; |
| 140 | + } catch(e) { |
| 141 | + this.handleReqFailure(e); |
| 142 | + return; |
| 143 | + } |
| 144 | + |
| 145 | + const excludedTagVersions = new Set(['v0.7', 'v0.8.1']); |
| 146 | + |
| 147 | + const tagOptions = tags |
| 148 | + .map(tag => tag.name) |
| 149 | + .filter(tag => tag.startsWith('v') && !excludedTagVersions.has(tag)); |
| 150 | + |
| 151 | + const latestRelease = tagOptions.find(tag => !tag.includes('rc')); |
| 152 | + this.viewVersion = latestRelease; |
| 153 | + this.versionOptions = this.versionOptions.concat(tagOptions); |
| 154 | + }, |
149 | 155 | async outputHtml() { |
150 | 156 | if (this.viewVersion !== this.oldViewVersion) { |
151 | 157 | const ConfigurationMdUrl = |
|
207 | 213 | }); |
208 | 214 | } |
209 | 215 | }, |
210 | | - created: async function() { |
211 | | - let tags; |
212 | | - try { |
213 | | - tags = (await axios.get(RustfmtTagsUrl)).data; |
214 | | - } catch(e) { |
215 | | - this.handleReqFailure(e); |
216 | | - return; |
217 | | - } |
218 | | - |
219 | | - const excludedTagVersions = new Set(['v0.7', 'v0.8.1']); |
220 | | - |
221 | | - const tagOptions = tags |
222 | | - .map(tag => tag.name) |
223 | | - .filter(tag => tag.startsWith('v') && !excludedTagVersions.has(tag)); |
224 | | - this.versionOptions = this.versionOptions.concat(tagOptions); |
225 | | - }, |
226 | 216 | updated() { |
227 | 217 | if (UrlHash === '') return; |
228 | 218 | this.$nextTick(() => { |
|
0 commit comments