@winchsa/ui 0.1.47 → 0.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,9 @@ import type { ApiResponse } from '../types';
3
3
  type RequestOptions = Omit<FetchOptions<'json'>, 'method'> & {
4
4
  ignoreUrlPrefix?: boolean;
5
5
  };
6
+ export declare const configureClient: (config: {
7
+ appType: string;
8
+ }) => void;
6
9
  export declare const client: {
7
10
  get: <T>(path: string, options?: RequestOptions) => Promise<ApiResponse<T>>;
8
11
  };
@@ -3,16 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.client = void 0;
6
+ exports.configureClient = exports.client = void 0;
7
7
  var _ofetch = require("ofetch");
8
8
  var _toaster = require("./toaster");
9
9
  var _i18n = require("./i18n");
10
10
  const clientInstance = _ofetch.ofetch.create({
11
11
  credentials: "include"
12
12
  });
13
+ let _appType = process.env.VITE_APP_TYPE;
14
+ const configureClient = config => {
15
+ _appType = config.appType;
16
+ };
17
+ exports.configureClient = configureClient;
13
18
  async function apiRequest(method, path, options) {
14
19
  const baseUrl = process.env.VITE_BASE_API;
15
- const prefix = process.env.VITE_APP_TYPE;
20
+ const prefix = _appType;
16
21
  const token = localStorage.getItem("token");
17
22
  const {
18
23
  ignoreUrlPrefix,
@@ -2,9 +2,13 @@ import { ofetch } from "ofetch";
2
2
  import { toaster } from "./toaster.mjs";
3
3
  import { i18n } from "./i18n.mjs";
4
4
  const clientInstance = ofetch.create({ credentials: "include" });
5
+ let _appType = import.meta.env.VITE_APP_TYPE;
6
+ export const configureClient = (config) => {
7
+ _appType = config.appType;
8
+ };
5
9
  async function apiRequest(method, path, options) {
6
10
  const baseUrl = import.meta.env.VITE_BASE_API;
7
- const prefix = import.meta.env.VITE_APP_TYPE;
11
+ const prefix = _appType;
8
12
  const token = localStorage.getItem("token");
9
13
  const { ignoreUrlPrefix, headers, ...restOptions } = options || {};
10
14
  return clientInstance(path, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winchsa/ui",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "publishConfig": {