File size: 997 Bytes
6aa6081
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import api from './api';

export interface FacialEnrollResponse {
  id: number;
  user_id: number;
  encoding_length: number;
  message: string;
}

export interface FacialRecognizeResponse {
  success: boolean;
  user_id: number | null;
  name: string | null;
  lastname: string | null;
  card_id: string | null;
  confidence: number | null;
  message: string;
  attendance_id: number | null;
}

export async function enrollFace(userId: number, image: string): Promise<FacialEnrollResponse> {
  const { data } = await api.post('/facial/enroll', { user_id: userId, image });
  return data;
}

export async function recognizeFace(image: string, late_note?: string): Promise<FacialRecognizeResponse> {
  const { data } = await api.post('/facial/recognize', { image, late_note });
  return data;
}

export async function facialCheckout(image: string, late_note?: string): Promise<FacialRecognizeResponse> {
  const { data } = await api.post('/facial/checkout', { image, late_note });
  return data;
}