This repository was archived by the owner on Oct 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -9,25 +9,26 @@ export const useBackend = () => {
9
9
* @param data Data.
10
10
*/
11
11
async function request ( method : HTTPMethod , path : string , data : object = { } ) {
12
- return await $fetch ( useRuntimeConfig ( ) . public . backend . url + path , {
13
- method : method ,
14
- headers : {
15
- "Authorization" : useRuntimeConfig ( ) . public . backend . authorization ,
16
- } ,
17
- body : method === "PUT" ? data : undefined ,
18
- } ) ;
12
+ try {
13
+ return await $fetch ( useRuntimeConfig ( ) . public . backend . url + path , {
14
+ method : method ,
15
+ headers : {
16
+ "Authorization" : useRuntimeConfig ( ) . public . backend . authorization ,
17
+ } ,
18
+ body : method === "PUT" ? data : undefined ,
19
+ } ) ;
20
+ } catch ( e ) {
21
+ console . error ( e ) ;
22
+ return { } ;
23
+ }
19
24
}
20
25
21
26
/**
22
27
* Fetch votes.
23
28
* @returns {Promise<PluginVotesSummary> } PluginVotesSummary.
24
29
*/
25
30
async function fetchVotes ( ) : Promise < PluginVotesSummary > {
26
- try {
27
- return await request ( "GET" , "" ) as PluginVotesSummary ;
28
- } catch ( e ) {
29
- return { } ;
30
- }
31
+ return await request ( "GET" , "" ) as PluginVotesSummary ;
31
32
}
32
33
33
34
/**
You can’t perform that action at this time.
0 commit comments