File tree 1 file changed +14
-13
lines changed
src/routes/team/[team]/[env]/app/[app]/utilization2
1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change 1
1
import { load_ResourceUtilizationForApp2 } from '$houdini' ;
2
2
import type { PageLoad } from './$houdini' ;
3
3
4
- export const ssr = false ;
5
- export const load : PageLoad = async ( event ) => {
6
- const interval = event . url . searchParams . get ( 'interval' ) ;
7
- const end = new Date ( Date . now ( ) ) ;
8
- let start = new Date ( Date . now ( ) - 7 * 24 * 1000 * 60 * 60 ) ;
4
+ function getStart ( interval : string | null ) {
9
5
switch ( interval ) {
10
6
case '1h' :
11
- start = new Date ( Date . now ( ) - 1000 * 60 * 60 ) ;
12
- break ;
7
+ return new Date ( Date . now ( ) - 1000 * 60 * 60 ) ;
13
8
case '6h' :
14
- start = new Date ( Date . now ( ) - 6 * 1000 * 60 * 60 ) ;
15
- break ;
9
+ return new Date ( Date . now ( ) - 6 * 1000 * 60 * 60 ) ;
16
10
case '1d' :
17
- start = new Date ( Date . now ( ) - 24 * 1000 * 60 * 60 ) ;
18
- break ;
11
+ return new Date ( Date . now ( ) - 24 * 1000 * 60 * 60 ) ;
19
12
case '30d' :
20
- start = new Date ( Date . now ( ) - 30 * 24 * 1000 * 60 * 60 ) ;
21
- break ;
13
+ return new Date ( Date . now ( ) - 30 * 24 * 1000 * 60 * 60 ) ;
14
+ default :
15
+ return new Date ( Date . now ( ) - 7 * 24 * 1000 * 60 * 60 ) ;
22
16
}
17
+ }
18
+
19
+ export const ssr = false ;
20
+ export const load : PageLoad = async ( event ) => {
21
+ const interval = event . url . searchParams . get ( 'interval' ) ;
22
+ const end = new Date ( Date . now ( ) ) ;
23
+ const start = getStart ( interval ) ;
23
24
24
25
return {
25
26
interval,
You can’t perform that action at this time.
0 commit comments