log
This commit is contained in:
@@ -10,11 +10,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
UseMutationOptions
|
UseMutationOptions
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
export const allTransactionCancelInfo = (params: AllTransactionCancelInfoParams) => {
|
export const allTransactionCancelInfo = (params: AllTransactionCancelInfoParams) => {
|
||||||
|
let headerOptions = {
|
||||||
|
menuId: 31,
|
||||||
|
apiType: 'SELECT'
|
||||||
|
};
|
||||||
|
let options = {
|
||||||
|
headers: {
|
||||||
|
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||||
|
}
|
||||||
|
};
|
||||||
return resultify(
|
return resultify(
|
||||||
axios.post<AllTransactionCancelInfoResponse>(API_URL_TRANSACTION.allTransactionCancelInfo(), params),
|
axios.post<AllTransactionCancelInfoResponse>(API_URL_TRANSACTION.allTransactionCancelInfo(), params, options),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
UseMutationOptions
|
UseMutationOptions
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
export const allTransactionCancel = (params: AllTransactionCancelParams) => {
|
export const allTransactionCancel = (params: AllTransactionCancelParams) => {
|
||||||
|
let headerOptions = {
|
||||||
|
menuId: 31,
|
||||||
|
apiType: 'SELECT'
|
||||||
|
};
|
||||||
|
let options = {
|
||||||
|
headers: {
|
||||||
|
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||||
|
}
|
||||||
|
};
|
||||||
return resultify(
|
return resultify(
|
||||||
axios.post<AllTransactionCancelResponse>(API_URL_TRANSACTION.allTransactionCancel(), params),
|
axios.post<AllTransactionCancelResponse>(API_URL_TRANSACTION.allTransactionCancel(), params, options),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
UseMutationOptions
|
UseMutationOptions
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
export const allTransactionDetail = (params: AllTransactionDetailParams) => {
|
export const allTransactionDetail = (params: AllTransactionDetailParams) => {
|
||||||
|
let headerOptions = {
|
||||||
|
menuId: 31,
|
||||||
|
apiType: 'SELECT'
|
||||||
|
};
|
||||||
|
let options = {
|
||||||
|
headers: {
|
||||||
|
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||||
|
}
|
||||||
|
};
|
||||||
return resultify(
|
return resultify(
|
||||||
axios.post<DetailResponse>(API_URL_TRANSACTION.allTransactionDetail(), params),
|
axios.post<DetailResponse>(API_URL_TRANSACTION.allTransactionDetail(), params, options),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
UseMutationOptions
|
UseMutationOptions
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
export const allTransactionList = (params: AllTransactionListParams) => {
|
export const allTransactionList = (params: AllTransactionListParams) => {
|
||||||
//axios.AxiosHeaders[]
|
let headerOptions = {
|
||||||
|
menuId: 31,
|
||||||
|
apiType: 'SELECT'
|
||||||
|
};
|
||||||
|
let options = {
|
||||||
|
headers: {
|
||||||
|
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||||
|
}
|
||||||
|
};
|
||||||
return resultify(
|
return resultify(
|
||||||
axios.post<AllTransactionListResponse>(API_URL_TRANSACTION.allTransactionList(), params),
|
axios.post<AllTransactionListResponse>(API_URL_TRANSACTION.allTransactionList(), params, options),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
UseMutationOptions
|
UseMutationOptions
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
export const allTransactionListSummary = (params: AllTransactionListSummaryParams) => {
|
export const allTransactionListSummary = (params: AllTransactionListSummaryParams) => {
|
||||||
|
let headerOptions = {
|
||||||
|
menuId: 31,
|
||||||
|
apiType: 'SELECT'
|
||||||
|
};
|
||||||
|
let options = {
|
||||||
|
headers: {
|
||||||
|
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||||
|
}
|
||||||
|
};
|
||||||
return resultify(
|
return resultify(
|
||||||
axios.post<AllTransactionListSummaryResponse>(API_URL_TRANSACTION.allTransactionListSummary(), params),
|
axios.post<AllTransactionListSummaryResponse>(API_URL_TRANSACTION.allTransactionListSummary(), params, options),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
UseMutationOptions
|
UseMutationOptions
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
export const cashReceiptDetail = (params: CashReceiptDetailParams) => {
|
export const cashReceiptDetail = (params: CashReceiptDetailParams) => {
|
||||||
|
let headerOptions = {
|
||||||
|
menuId: 32,
|
||||||
|
apiType: 'SELECT'
|
||||||
|
};
|
||||||
|
let options = {
|
||||||
|
headers: {
|
||||||
|
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||||
|
}
|
||||||
|
};
|
||||||
return resultify(
|
return resultify(
|
||||||
axios.post<DetailResponse>(API_URL_TRANSACTION.cashReceiptDetail(), params),
|
axios.post<DetailResponse>(API_URL_TRANSACTION.cashReceiptDetail(), params, options),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
UseMutationOptions
|
UseMutationOptions
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
export const cashReceiptList = (params: CashReceiptListParams) => {
|
export const cashReceiptList = (params: CashReceiptListParams) => {
|
||||||
|
let headerOptions = {
|
||||||
|
menuId: 32,
|
||||||
|
apiType: 'SELECT'
|
||||||
|
};
|
||||||
|
let options = {
|
||||||
|
headers: {
|
||||||
|
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||||
|
}
|
||||||
|
};
|
||||||
return resultify(
|
return resultify(
|
||||||
axios.post<CashReceiptListResponse>(API_URL_TRANSACTION.cashReceiptList(), params),
|
axios.post<CashReceiptListResponse>(API_URL_TRANSACTION.cashReceiptList(), params, options),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
UseMutationOptions
|
UseMutationOptions
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
export const cashReceiptManualIssue = (params: CashReceiptManualIssueParams) => {
|
export const cashReceiptManualIssue = (params: CashReceiptManualIssueParams) => {
|
||||||
|
let headerOptions = {
|
||||||
|
menuId: 32,
|
||||||
|
apiType: 'INSERT'
|
||||||
|
};
|
||||||
|
let options = {
|
||||||
|
headers: {
|
||||||
|
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||||
|
}
|
||||||
|
};
|
||||||
return resultify(
|
return resultify(
|
||||||
axios.post<CashReceiptManualIssueResponse>(API_URL_TRANSACTION.cashReceiptManualIssue(), params),
|
axios.post<CashReceiptManualIssueResponse>(API_URL_TRANSACTION.cashReceiptManualIssue(), params, options),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,20 @@ import {
|
|||||||
useMutation,
|
useMutation,
|
||||||
UseMutationOptions
|
UseMutationOptions
|
||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
export const cashReceiptPurposeUpdate = (params: CashReceiptPurposeUpdateParams) => {
|
export const cashReceiptPurposeUpdate = (params: CashReceiptPurposeUpdateParams) => {
|
||||||
|
let headerOptions = {
|
||||||
|
menuId: 32,
|
||||||
|
apiType: 'UPDATE'
|
||||||
|
};
|
||||||
|
let options = {
|
||||||
|
headers: {
|
||||||
|
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||||
|
}
|
||||||
|
};
|
||||||
return resultify(
|
return resultify(
|
||||||
axios.post<CashReceiptPurposeUpdateResponse>(API_URL_TRANSACTION.cashReceiptPurposeUpdate(), params),
|
axios.post<CashReceiptPurposeUpdateResponse>(API_URL_TRANSACTION.cashReceiptPurposeUpdate(), params, options),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,17 +4,20 @@ import { WHITE_LIST_URLS } from '@/shared/api/urls';
|
|||||||
import { StorageKeys } from '@/shared/constants/local-storage';
|
import { StorageKeys } from '@/shared/constants/local-storage';
|
||||||
import { checkIsAxiosError, getLocalStorage, setLocalStorage } from '@/shared/lib';
|
import { checkIsAxiosError, getLocalStorage, setLocalStorage } from '@/shared/lib';
|
||||||
import { finalizeConfig } from './utils';
|
import { finalizeConfig } from './utils';
|
||||||
import { HEADER_USER_AGENT } from '@/shared/constants/url';
|
|
||||||
import { appBridge } from '@/utils/appBridge';
|
import { appBridge } from '@/utils/appBridge';
|
||||||
import { useAppBridge } from '@/hooks';
|
import { useAppBridge } from '@/hooks';
|
||||||
import { useUserInfo } from '@/entities/user/lib/use-user-info';
|
import { useUserInfo } from '@/entities/user/lib/use-user-info';
|
||||||
import { LoginResponse } from '@/entities/user/model/types';
|
import { LoginResponse } from '@/entities/user/model/types';
|
||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
|
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||||
|
|
||||||
const onRequestFulfilled = (config: InternalAxiosRequestConfig) => {
|
const onRequestFulfilled = (config: InternalAxiosRequestConfig) => {
|
||||||
config.headers['Content-Type'] = 'application/json;charset=UTF-8';
|
config.headers['Content-Type'] = 'application/json;charset=UTF-8';
|
||||||
config.headers['X-User-Agent'] = HEADER_USER_AGENT;
|
|
||||||
|
|
||||||
|
if(!config.headers['X-User-Agent']){
|
||||||
|
config.headers['X-User-Agent'] = getHeaderUserAgent();
|
||||||
|
}
|
||||||
|
|
||||||
if(WHITE_LIST_URLS.includes(config?.url ?? '')){
|
if(WHITE_LIST_URLS.includes(config?.url ?? '')){
|
||||||
if(config.headers.hasOwnProperty('Authorization')){
|
if(config.headers.hasOwnProperty('Authorization')){
|
||||||
delete config.headers.Authorization;
|
delete config.headers.Authorization;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const getAPIAuthBaseUrl = () => {
|
|||||||
}
|
}
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
const getHeaderUserAgent = (options?: {
|
export const getHeaderUserAgent = (options?: {
|
||||||
menuId?: number,
|
menuId?: number,
|
||||||
apiType?: string
|
apiType?: string
|
||||||
}) => {
|
}) => {
|
||||||
@@ -32,12 +32,11 @@ const getHeaderUserAgent = (options?: {
|
|||||||
let appVersion = '1.0.0';
|
let appVersion = '1.0.0';
|
||||||
let browserInformation = result.browser.name;
|
let browserInformation = result.browser.name;
|
||||||
|
|
||||||
return `${os} ${deviceType} ${deviceID} ${appVersion} ${browserInformation} ${options?.menuId} ${options?.apiType}`;
|
return `${os} ${deviceType} ${deviceID} ${appVersion} ${browserInformation} ${options?.menuId || ''} ${options?.apiType || ''}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const API_BASE_URL = getAPIBaseUrl();
|
export const API_BASE_URL = getAPIBaseUrl();
|
||||||
export const API_AUTH_BASE_URL = getAPIAuthBaseUrl();
|
export const API_AUTH_BASE_URL = getAPIAuthBaseUrl();
|
||||||
export const API_URL_KEY = 'nmsa';
|
export const API_URL_KEY = 'nmsa';
|
||||||
export const HEADER_USER_AGENT = getHeaderUserAgent();
|
|
||||||
export const API_PARAM = {};
|
export const API_PARAM = {};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user