File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -394,12 +394,14 @@ interface GetAuditLogsOptions {
394
394
offset : number
395
395
}
396
396
397
- export const getAuditLogs = async ( options : GetAuditLogsOptions ) : Promise < TypesGen . AuditLog [ ] > => {
397
+ export const getAuditLogs = async (
398
+ options : GetAuditLogsOptions ,
399
+ ) : Promise < TypesGen . AuditLogResponse > => {
398
400
const response = await axios . get ( `/api/v2/audit?limit=${ options . limit } &offset=${ options . offset } ` )
399
401
return response . data
400
402
}
401
403
402
- export const getAuditLogsCount = async ( ) : Promise < number > => {
404
+ export const getAuditLogsCount = async ( ) : Promise < TypesGen . AuditLogCountResponse > => {
403
405
const response = await axios . get ( `/api/v2/audit/count` )
404
406
return response . data
405
407
}
Original file line number Diff line number Diff line change 1
1
import { getAuditLogs , getAuditLogsCount } from "api/api"
2
2
import { getErrorMessage } from "api/errors"
3
+ import { AuditLog } from "api/typesGenerated"
3
4
import { displayError } from "components/GlobalSnackbar/utils"
4
5
import { assign , createMachine } from "xstate"
5
6
6
- type AuditLogs = Awaited < ReturnType < typeof getAuditLogs > >
7
-
8
7
export const auditMachine = createMachine (
9
8
{
10
9
id : "auditMachine" ,
11
10
schema : {
12
- context : { } as { auditLogs ?: AuditLogs ; count ?: number ; page : number ; limit : number } ,
11
+ context : { } as { auditLogs ?: AuditLog [ ] ; count ?: number ; page : number ; limit : number } ,
13
12
services : { } as {
14
13
loadAuditLogs : {
15
- data : AuditLogs
14
+ data : AuditLog [ ]
16
15
}
17
16
loadAuditLogsCount : {
18
17
data : number
@@ -111,8 +110,8 @@ export const auditMachine = createMachine(
111
110
// The page in the API starts at 0
112
111
offset : ( page - 1 ) * limit ,
113
112
limit,
114
- } ) ,
115
- loadAuditLogsCount : ( ) => getAuditLogsCount ( ) ,
113
+ } ) . then ( ( data ) => data . audit_logs ) ,
114
+ loadAuditLogsCount : ( ) => getAuditLogsCount ( ) . then ( ( data ) => data . count ) ,
116
115
} ,
117
116
} ,
118
117
)
You can’t perform that action at this time.
0 commit comments