mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
merge: resolve conflict
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import { BaseApiService } from '@/services/api/base';
|
||||
import {
|
||||
CreateProductWarehousePayload,
|
||||
ProductWarehouse,
|
||||
UpdateProductWarehousePayload,
|
||||
} from '@/types/api/inventory/product-warehouse';
|
||||
import {
|
||||
CreateMovementPayload,
|
||||
Movement,
|
||||
@@ -7,17 +12,22 @@ import {
|
||||
import {
|
||||
CreateInventoryAdjustmentPayload,
|
||||
InventoryAdjustment,
|
||||
UpdateInventoryAdjustmentPayload,
|
||||
} from '@/types/api/inventory/adjustment';
|
||||
|
||||
export const ProductWarehouseApi = new BaseApiService<
|
||||
ProductWarehouse,
|
||||
CreateProductWarehousePayload,
|
||||
UpdateProductWarehousePayload
|
||||
>('/inventory/product-warehouses');
|
||||
|
||||
export const MovementApi = new BaseApiService<
|
||||
Movement,
|
||||
CreateMovementPayload,
|
||||
UpdateMovementPayload
|
||||
>('/inventory/movements');
|
||||
>('/inventory/transfers');
|
||||
|
||||
export const inventoryAdjustmentApi = new BaseApiService<
|
||||
InventoryAdjustment,
|
||||
CreateInventoryAdjustmentPayload,
|
||||
UpdateInventoryAdjustmentPayload
|
||||
unknown
|
||||
>('/inventory/adjustments');
|
||||
|
||||
@@ -14,6 +14,9 @@ export async function httpClient<T, B = unknown>(
|
||||
(!opts.auth && opts.auth !== 'none' && opts.auth !== 'bearer');
|
||||
const isBearerAuth = opts.auth === 'bearer' && !!opts.token;
|
||||
|
||||
const isFormData =
|
||||
typeof FormData !== 'undefined' && opts.body instanceof FormData;
|
||||
|
||||
const config: AxiosRequestConfig = {
|
||||
url: path,
|
||||
method: opts.method ?? 'GET',
|
||||
@@ -22,7 +25,7 @@ export async function httpClient<T, B = unknown>(
|
||||
timeout: opts.timeoutMs ?? 10_000,
|
||||
withCredentials: isCookieAuth && !isBearerAuth,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...(isFormData ? {} : { 'Content-Type': 'application/json' }),
|
||||
...(opts.headers ?? {}),
|
||||
...(isBearerAuth && !isCookieAuth
|
||||
? { Authorization: `Bearer ${opts.token}` }
|
||||
|
||||
Reference in New Issue
Block a user