UIKit/lib/api/account.ts
2023-12-19 17:57:44 +03:00

28 lines
772 B
TypeScript

import { UserAccount, UserName } from "../model/account";
import { makeRequest } from "./makeRequest";
const apiUrl = process.env.NODE_ENV === "production" ? "/customer" : "https://hub.pena.digital/customer";
export function patchUserAccount(user: UserName) {
return makeRequest<UserName, UserAccount>({
url: apiUrl + "/account",
contentType: true,
method: "PATCH",
useToken: true,
withCredentials: false,
body: user,
});
}
export function createUserAccount(signal: AbortSignal, url: string = apiUrl + "/account") {
return makeRequest<never, UserAccount>({
url: url,
contentType: true,
method: "POST",
useToken: true,
withCredentials: false,
signal,
});
}