28 lines
864 B
TypeScript
28 lines
864 B
TypeScript
import { UserAccount, UserName } from "../model/account";
|
|
import { makeRequest } from "./makeRequest";
|
|
|
|
const apiUrl = import.meta.env.VITE__APP_DOMAIN + "/customer";
|
|
|
|
|
|
export function patchUserAccount(user: UserName, version:string | undefined) {
|
|
return makeRequest<UserName, UserAccount>({
|
|
url: `${apiUrl + (version ? `/${version}` : "")}/account`,
|
|
contentType: true,
|
|
method: "PATCH",
|
|
useToken: true,
|
|
withCredentials: false,
|
|
body: user,
|
|
});
|
|
}
|
|
|
|
export function createUserAccount(signal: AbortSignal, url: string | undefined, version: string) {
|
|
return makeRequest<never, UserAccount>({
|
|
url: url || `${apiUrl + (version.length > 0 ? `/${version}` : "")}/account`,
|
|
contentType: true,
|
|
method: "POST",
|
|
useToken: true,
|
|
withCredentials: false,
|
|
signal,
|
|
});
|
|
}
|