@@ -2,34 +2,28 @@ import client from '$lib/clients/client';
2
2
import type { PageServerLoad } from './$types' ;
3
3
4
4
export const load : PageServerLoad = async ( { params } ) => {
5
- const {
6
- data : quibs_data ,
7
- error : quibs_error ,
8
- response : quibs_response
9
- } = await client . GET ( '/api/v1/quiblets/{name}/quibs/' , {
10
- params : {
11
- path : { name : params . name }
12
- }
13
- } ) ;
14
-
15
- const {
16
- data : highlighted_quibs_data ,
17
- error : highlighted_quibs_error ,
18
- response : highlighted_quibs_response
19
- } = await client . GET ( '/api/v1/quiblets/{name}/highlighted_quibs/' , {
20
- params : {
21
- path : { name : params . name }
22
- }
23
- } ) ;
5
+ const [ quibs , highlighted_quibs ] = await Promise . all ( [
6
+ client . GET ( '/api/v1/quiblets/{name}/quibs/' , {
7
+ params : {
8
+ path : { name : params . name }
9
+ }
10
+ } ) ,
11
+ client . GET ( '/api/v1/quiblets/{name}/highlighted_quibs/' , {
12
+ params : {
13
+ path : { name : params . name }
14
+ }
15
+ } )
16
+ ] ) ;
24
17
25
18
if (
26
- quibs_response . ok &&
27
- quibs_data &&
28
- highlighted_quibs_response &&
29
- highlighted_quibs_data
19
+ quibs . response . ok &&
20
+ quibs . data &&
21
+ highlighted_quibs . response &&
22
+ highlighted_quibs . data
30
23
) {
31
- return { quibs : quibs_data , highlighted_quibs : highlighted_quibs_data } ;
32
- } else if ( quibs_error || highlighted_quibs_error ) {
33
- console . error ( quibs_error , highlighted_quibs_error ) ;
24
+ return { quibs : quibs . data , highlighted_quibs : highlighted_quibs . data } ;
25
+ } else {
26
+ const errors = [ quibs . error , highlighted_quibs . error ] . filter ( ( error ) => error ) ;
27
+ console . error ( errors ) ;
34
28
}
35
29
} ;
0 commit comments