1/*
2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import Log from '../utils/log';
17import UserIdmModel from '../model/userIdmModel';
18import CommonController from '../controller/commonController';
19
20class FaceConfigController {
21  private readonly TAG: string = 'FaceConfigController';
22
23  constructor() {
24    Log.info(this.TAG, 'constructor+');
25    Log.info(this.TAG, 'constructor-');
26  }
27
28  deleteFace(): void {
29    Log.info(this.TAG, 'deleteFace+');
30    UserIdmModel.deleteFace().then((result)=>{
31      Log.info(this.TAG, 'deleteFace result: ' + result);
32      if (result === 0) {
33        Log.info(this.TAG, 'deleteFace routeBack+');
34        CommonController.routeBack();
35        Log.info(this.TAG, 'deleteFace routerBack-');
36      } else {
37        Log.error(this.TAG, 'deleteFace fail');
38      }
39    }).catch(()=>{
40      Log.error(this.TAG, 'deleteFace exception');
41      CommonController.routeBack();
42    });
43    const TIME_MS = 500;
44    setTimeout(() => {
45      CommonController.routeBack();
46    }, TIME_MS);
47    Log.info(this.TAG, 'deleteFace-');
48  }
49}
50
51let faceConfigController = new FaceConfigController();
52export default faceConfigController as FaceConfigController;