File tree Expand file tree Collapse file tree 4 files changed +6
-261
lines changed Expand file tree Collapse file tree 4 files changed +6
-261
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import { cached } from '@glimmer/tracking';
4
4
5
5
import { apiAction } from '@mainmatter/ember-api-actions' ;
6
6
import { keepLatestTask , task } from 'ember-concurrency' ;
7
- import fetch from 'fetch' ;
8
7
import { alias } from 'macro-decorators' ;
9
8
import semverParse from 'semver/functions/parse' ;
10
9
@@ -135,7 +134,7 @@ export default class Version extends Model {
135
134
136
135
loadReadmeTask = keepLatestTask ( async ( ) => {
137
136
if ( this . readme_path ) {
138
- let response = await fetch ( this . readme_path ) ;
137
+ let response = await waitForPromise ( fetch ( this . readme_path ) ) ;
139
138
if ( response . status === 404 || response . status === 403 ) {
140
139
return ;
141
140
}
@@ -144,7 +143,7 @@ export default class Version extends Model {
144
143
throw new Error ( `README request for ${ this . crateName } v${ this . num } failed` ) ;
145
144
}
146
145
147
- return await response . text ( ) ;
146
+ return await waitForPromise ( response . text ( ) ) ;
148
147
}
149
148
} ) ;
150
149
Original file line number Diff line number Diff line change 1
1
import { runInDebug } from '@ember/debug' ;
2
-
3
- import fetch from 'fetch' ;
2
+ import { waitForPromise } from '@ember/test-waiters' ;
4
3
5
4
export default async function ajax ( input , init ) {
6
5
let method = init ?. method ?? 'GET' ;
7
6
8
7
let cause ;
9
8
try {
10
- let response = await fetch ( input , init ) ;
9
+ let response = await waitForPromise ( fetch ( input , init ) ) ;
11
10
if ( response . ok ) {
12
- return await response . json ( ) ;
11
+ return await waitForPromise ( response . json ( ) ) ;
13
12
}
14
13
cause = new HttpError ( { url : input , method, response } ) ;
15
14
} catch ( error ) {
@@ -68,7 +67,7 @@ export class AjaxError extends Error {
68
67
69
68
async json ( ) {
70
69
try {
71
- return await this . cause . response . json ( ) ;
70
+ return await waitForPromise ( this . cause . response . json ( ) ) ;
72
71
} catch {
73
72
// ignore errors and implicitly return `undefined`
74
73
}
Original file line number Diff line number Diff line change 102
102
"ember-error-route" : " 0.2.0" ,
103
103
"ember-event-helpers" : " 0.1.1" ,
104
104
"ember-exam" : " 9.1.0" ,
105
- "ember-fetch" : " 8.1.2" ,
106
105
"ember-inflector" : " 6.0.0" ,
107
106
"ember-keyboard" : " 9.0.1" ,
108
107
"ember-link" : " 3.3.0" ,
You can’t perform that action at this time.
0 commit comments