2.1.0 env update
This commit is contained in:
parent
0a2a0128ef
commit
7cd9998563
@ -1,3 +1,4 @@
|
||||
- Теперь запросы не по переменным окружения, а по глобальной переменной
|
||||
- Бог в помощь
|
||||
- Обновлены все пакеты
|
||||
- Убран yarn
|
||||
|
||||
11
env.d.ts
vendored
11
env.d.ts
vendored
@ -1,11 +0,0 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_REACT_APP_DOMAIN: string;
|
||||
readonly VITE_API_KEY: string;
|
||||
// Добавьте другие переменные окружения, которые вы используете
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv;
|
||||
}
|
||||
@ -2,7 +2,7 @@ import { UserAccount, UserName } from "../model/account";
|
||||
import { makeRequest } from "./makeRequest";
|
||||
|
||||
|
||||
const apiUrl = import.meta.env.VITE__APP_DOMAIN + "/customer";
|
||||
const apiUrl = window.the_domain + "/customer";
|
||||
|
||||
export function patchUserAccount(user: UserName, version:string | undefined) {
|
||||
return makeRequest<UserName, UserAccount>({
|
||||
|
||||
@ -66,7 +66,7 @@ export async function makeRequest<TRequest = unknown, TResponse = unknown>({
|
||||
|
||||
function refresh(token: string) {
|
||||
|
||||
return axios<never, AxiosResponse<{ accessToken: string; }>>(import.meta.env.VITE__APP_DOMAIN + "/auth/refresh", {
|
||||
return axios<never, AxiosResponse<{ accessToken: string; }>>(window.the_domain + "/auth/refresh", {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${token}`,
|
||||
"Content-Type": "application/json",
|
||||
|
||||
@ -4,7 +4,7 @@ import { makeRequest } from "./makeRequest";
|
||||
|
||||
export function getTariffById(tariffId:string){
|
||||
return makeRequest<never, Tariff>({
|
||||
url: import.meta.env.VITE__APP_DOMAIN + `/strator/tariff/${tariffId}`,
|
||||
url: window.the_domain + `/strator/tariff/${tariffId}`,
|
||||
method: "get",
|
||||
useToken: true,
|
||||
});
|
||||
|
||||
7
lib/env.d.ts
vendored
7
lib/env.d.ts
vendored
@ -1,7 +0,0 @@
|
||||
export declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
readonly NODE_ENV: 'development' | 'production' | 'test';
|
||||
}
|
||||
}
|
||||
}
|
||||
3
lib/global.d.ts
vendored
Normal file
3
lib/global.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
interface Window {
|
||||
the_domain: string;
|
||||
}
|
||||
@ -5,7 +5,7 @@ import { makeRequest } from "../api/makeRequest";
|
||||
|
||||
export function useAllTariffsFetcher({
|
||||
enabled = true,
|
||||
baseUrl = import.meta.env.VITE__APP_DOMAIN + "/strator/tariff",
|
||||
baseUrl = window.the_domain + "/strator/tariff",
|
||||
onSuccess,
|
||||
onError,
|
||||
}: {
|
||||
|
||||
@ -5,7 +5,7 @@ import { Privilege } from "../model";
|
||||
|
||||
export function usePrivilegeFetcher({
|
||||
onSuccess,
|
||||
url = import.meta.env.VITE__APP_DOMAIN + "/strator/privilege",
|
||||
url = window.the_domain + "/strator/privilege",
|
||||
onError,
|
||||
}: {
|
||||
onSuccess: (response: Privilege[]) => void;
|
||||
|
||||
@ -24,7 +24,7 @@ export function getMessageFromFetchError(error: any, defaultMessage = "Что-т
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === "development") return rawMessage ?? error.message ?? defaultMessage;
|
||||
if (window.the_domain === "dev") return rawMessage ?? error.message ?? defaultMessage;
|
||||
|
||||
return defaultMessage;
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
export const devlog: typeof console.log = (...args) => {
|
||||
if (process.env.NODE_ENV === "development") console.log(...args);
|
||||
if (window.the_domain === "dev") console.log(...args);
|
||||
};
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@frontend/kitui",
|
||||
"version": "2.0.2",
|
||||
"version": "2.1.0",
|
||||
"description": "test",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
1
src/vite-env.d.ts
vendored
1
src/vite-env.d.ts
vendored
@ -1 +0,0 @@
|
||||
/// <reference types="vite/client" />
|
||||
Loading…
Reference in New Issue
Block a user