2023-07-06 21:52:07 +00:00
|
|
|
import { makeRequest } from "@frontend/kitui";
|
|
|
|
|
2023-07-09 10:30:29 +00:00
|
|
|
import { jsonToFormdata } from "@root/utils/json-to-formdata.util";
|
|
|
|
|
|
|
|
import type { Verification, SendDocumentsArgs } from "@root/model/auth";
|
2023-07-06 21:52:07 +00:00
|
|
|
|
|
|
|
const apiUrl =
|
|
|
|
process.env.NODE_ENV === "production" ? "" : "https://hub.pena.digital";
|
|
|
|
|
2023-07-13 12:11:30 +00:00
|
|
|
export function verification(userId: string) {
|
2023-07-06 21:52:07 +00:00
|
|
|
return makeRequest<never, Verification>({
|
2023-07-13 12:11:30 +00:00
|
|
|
url: apiUrl + "/verification/verification/" + userId,
|
2023-07-06 21:52:07 +00:00
|
|
|
method: "GET",
|
|
|
|
useToken: true,
|
|
|
|
withCredentials: true,
|
|
|
|
});
|
|
|
|
}
|
2023-07-09 10:30:29 +00:00
|
|
|
|
2023-07-13 12:11:30 +00:00
|
|
|
export function sendDocuments(userId: string, documents: SendDocumentsArgs) {
|
2023-07-09 10:30:29 +00:00
|
|
|
const formData = jsonToFormdata(documents);
|
|
|
|
|
|
|
|
return makeRequest<FormData, Verification>({
|
2023-07-13 12:11:30 +00:00
|
|
|
url: apiUrl + "/verification/verification/" + userId,
|
2023-07-09 10:30:29 +00:00
|
|
|
method: "POST",
|
|
|
|
useToken: true,
|
2023-07-13 12:11:30 +00:00
|
|
|
withCredentials: true,
|
2023-07-09 10:30:29 +00:00
|
|
|
body: formData,
|
|
|
|
});
|
|
|
|
}
|