add account api functions

This commit is contained in:
nflnkr 2023-08-28 17:18:03 +03:00
parent 77a8ff5cc0
commit 31058d1604
3 changed files with 29 additions and 2 deletions

26
lib/api/account.ts Normal file

@ -0,0 +1,26 @@
import { UserAccount, UserName, makeRequest } from "@frontend/kitui";
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) {
return makeRequest<never, UserAccount>({
url: apiUrl + "/account",
contentType: true,
method: "POST",
useToken: true,
withCredentials: false,
signal,
});
}

@ -1,3 +1,4 @@
export * from "./account";
export * from "./makeRequest";
export * from "./tariff";
export * from "./tickets";
export * from "./tickets";

@ -1,6 +1,6 @@
{
"name": "@frontend/kitui",
"version": "1.0.40",
"version": "1.0.41",
"description": "test",
"main": "./dist/index.js",
"module": "./dist/index.js",