File tree 1 file changed +14
-11
lines changed
1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change 1
1
<script >
2
- import $ from ' jquery' ;
3
2
import {SvgIcon } from ' ../svg.js' ;
4
3
import {useLightTextOnBackground } from ' ../utils/color.js' ;
5
4
import tinycolor from ' tinycolor2' ;
5
+ import {GET } from ' ../modules/fetch.js' ;
6
6
7
7
const {appSubUrl , i18n } = window .config ;
8
8
@@ -80,20 +80,23 @@ export default {
80
80
});
81
81
},
82
82
methods: {
83
- load (data ) {
83
+ async load (data ) {
84
84
this .loading = true ;
85
85
this .i18nErrorMessage = null ;
86
- $ . get ( ` ${ appSubUrl } / ${ data . owner } / ${ data . repo } /issues/ ${ data . index } /info ` ). done (( issue ) => {
87
- this . issue = issue;
88
- }). fail (( jqXHR ) => {
89
- if ( jqXHR . responseJSON && jqXHR . responseJSON . message ) {
90
- this . i18nErrorMessage = jqXHR . responseJSON . message ;
91
- } else {
92
- this . i18nErrorMessage = i18n . network_error ;
86
+
87
+ try {
88
+ const response = await GET ( ` ${ appSubUrl } / ${ data . owner } / ${ data . repo } /issues/ ${ data . index } /info ` );
89
+ const respJson = await response . json ();
90
+ if ( ! response . ok ) {
91
+ this . i18nErrorMessage = respJson . message ?? i18n . network_error ;
92
+ return ;
93
93
}
94
- }).always (() => {
94
+ this .issue = respJson;
95
+ } catch {
96
+ this .i18nErrorMessage = i18n .network_error ;
97
+ } finally {
95
98
this .loading = false ;
96
- });
99
+ }
97
100
}
98
101
}
99
102
};
You can’t perform that action at this time.
0 commit comments