общая переменная для запросов из любого проекта
This commit is contained in:
parent
3280b82e7c
commit
b24edcad37
@ -2,7 +2,7 @@ import { UserAccount, UserName } from "../model/account";
|
||||
import { makeRequest } from "./makeRequest";
|
||||
|
||||
|
||||
const apiUrl = process.env.NODE_ENV === "production" ? "/customer" : "https://hub.pena.digital/customer";
|
||||
const apiUrl = process.env.REACT_APP_DOMAIN + "/customer";
|
||||
|
||||
export function patchUserAccount(user: UserName) {
|
||||
return makeRequest<UserName, UserAccount>({
|
||||
|
||||
@ -62,7 +62,7 @@ export async function makeRequest<TRequest = unknown, TResponse = unknown>({
|
||||
}
|
||||
|
||||
function refresh(token: string) {
|
||||
return axios<never, AxiosResponse<{ accessToken: string; }>>("https://admin.pena.digital/auth/refresh", {
|
||||
return axios<never, AxiosResponse<{ accessToken: string; }>>(process.env.REACT_APP_DOMAIN + "/auth/refresh", {
|
||||
headers: {
|
||||
"Authorization": token,
|
||||
"Content-Type": "application/json",
|
||||
|
||||
@ -4,7 +4,7 @@ import { makeRequest } from "./makeRequest";
|
||||
|
||||
export function getTariffById(tariffId:string){
|
||||
return makeRequest<never, Tariff>({
|
||||
url: `https://admin.pena.digital/strator/tariff/${tariffId}`,
|
||||
url: process.env.REACT_APP_DOMAIN + `/strator/tariff/${tariffId}`,
|
||||
method: "get",
|
||||
useToken: true,
|
||||
});
|
||||
|
||||
@ -5,7 +5,7 @@ import { makeRequest } from "../api/makeRequest";
|
||||
|
||||
export function useAllTariffsFetcher({
|
||||
enabled = true,
|
||||
baseUrl = process.env.NODE_ENV === "production" ? "/strator/tariff" : "https://hub.pena.digital/strator/tariff",
|
||||
baseUrl = process.env.REACT_APP_DOMAIN + "/strator/tariff",
|
||||
onSuccess,
|
||||
onError,
|
||||
}: {
|
||||
|
||||
@ -5,7 +5,7 @@ import { PrivilegeWithAmount } from "../model";
|
||||
|
||||
export function usePrivilegeFetcher({
|
||||
onSuccess,
|
||||
url = process.env.NODE_ENV === "production" ? "/strator/privilege" : "https://admin.pena.digital/strator/privilege",
|
||||
url = process.env.REACT_APP_DOMAIN + "/strator/privilege",
|
||||
onError,
|
||||
}: {
|
||||
onSuccess: (response: PrivilegeWithAmount[]) => void;
|
||||
|
||||
12
package.json
12
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@frontend/kitui",
|
||||
"version": "1.0.55",
|
||||
"version": "1.0.56",
|
||||
"description": "test",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@ -37,23 +37,23 @@
|
||||
"@mui/icons-material": "^5.14.3",
|
||||
"@mui/material": "^5.14.4",
|
||||
"@types/node": "^20.5.0",
|
||||
"@types/react": "^18.2.15",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@types/react-syntax-highlighter": "^15.5.7",
|
||||
"@types/react": "^18.2.15",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"@vitejs/plugin-react": "^4.0.3",
|
||||
"axios": "^1.4.0",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.3",
|
||||
"eslint": "^8.45.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.15.0",
|
||||
"react-syntax-highlighter": "^15.5.0",
|
||||
"react": "^18.2.0",
|
||||
"typescript": "^5.0.2",
|
||||
"vite-plugin-dts": "^3.5.2",
|
||||
"vite": "^4.4.5",
|
||||
"vite-plugin-dts": "^3.5.2",
|
||||
"zustand": "^4.3.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
@ -62,8 +62,8 @@
|
||||
"@mui/icons-material": "^5.14.3",
|
||||
"@mui/material": "^5.14.4",
|
||||
"axios": "^1.4.0",
|
||||
"react-router-dom": "^6.15.0",
|
||||
"react": "^18.2.0",
|
||||
"react-router-dom": "^6.15.0",
|
||||
"zustand": "^4.3.8"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user