ringfinger/js/api/FingerprintGetApiRequest.ts

19 lines
650 B
TypeScript

import ApiRequest from "./ApiRequest.js";
import RequestMethod from "./RequestMethod.js";
import Fingerprint from "../types/Fingerprint.js";
import FingerprintGetEvent from "../event/FingerprintGetEvent.js";
export default class FingerprintGetApiRequest extends ApiRequest
{
public constructor(fingerprintId: number) {
super('fingerprint/' + fingerprintId, RequestMethod.GET);
this.onSuccess = (response: string): void => {
let json = JSON.parse(response);
let fingerprint = new Fingerprint(json.result.fingerprintId, json.result.fingerprint, json.result.userId);
window.dispatchEvent(new FingerprintGetEvent(fingerprint));
}
}
}