@fadyshawky/react-native-magic 2.0.7 → 2.0.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fadyshawky/react-native-magic",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "react native template with ready components, hooks, react navigation, redux, typescript, etc.",
5
5
  "keywords": [
6
6
  "react-native-magic",
@@ -1,6 +1,5 @@
1
1
  import axios, {AxiosDefaults} from 'axios';
2
2
  import DeviceInfo from 'react-native-device-info';
3
- import {fetch} from 'react-native-ssl-pinning';
4
3
 
5
4
  export const defaultHeaders: HeadersInit_ = {
6
5
  'app-version': DeviceInfo.getVersion(),
@@ -14,7 +13,7 @@ declare type MethodData = {
14
13
  config?: any;
15
14
  };
16
15
 
17
- const baseURL = 'https://sofapi.neo-dg.app/api/v1/mobile/';
16
+ const baseURL = '';
18
17
 
19
18
  const instance = axios.create({
20
19
  baseURL: baseURL,
@@ -23,63 +22,6 @@ const instance = axios.create({
23
22
  },
24
23
  });
25
24
 
26
- export async function configureSecureRequest() {
27
- // Only apply SSL pinning in production
28
- if (baseURL.includes('neopayplus')) {
29
- try {
30
- instance.defaults.adapter = (config: any) => {
31
- const url = `${config.baseURL}${config.url}`;
32
- const fetchOptions: any = {
33
- method: config.method?.toUpperCase() || 'GET',
34
- timeoutInterval: 0,
35
- headers: {
36
- ...config.headers,
37
- Accept: 'application/json',
38
- 'Content-Type': 'application/json',
39
- },
40
- // Don't double stringify the data
41
- body: config.data ? config.data : undefined,
42
- sslPinning: {
43
- certs: ['STAR.neopayplus.com'],
44
- allowInvalidCertificates: false,
45
- validatesDomainName: true,
46
- },
47
- };
48
-
49
- if (fetchOptions.method === 'GET' || fetchOptions.method === 'HEAD') {
50
- delete fetchOptions.body;
51
- }
52
-
53
- return fetch(url, fetchOptions)
54
- .then(async response => {
55
- const data = await response.json();
56
- return {
57
- data,
58
- status: response.status,
59
- statusText: response.statusText,
60
- headers: response.headers,
61
- config,
62
- request: {},
63
- };
64
- })
65
- .catch(error => {
66
- console.error('error: ', error);
67
- if (error === 'timeout') {
68
- throw new Error(error);
69
- } else if (JSON.parse(error?.bodyString)?.error) {
70
- throw new Error(JSON.parse(error?.bodyString)?.error);
71
- } else if (JSON.parse(error?.bodyString)?.message) {
72
- throw new Error(JSON.parse(error?.bodyString)?.message);
73
- }
74
- });
75
- };
76
- } catch (error) {
77
- console.info('error: ', error);
78
- throw error;
79
- }
80
- }
81
- }
82
-
83
25
  // Export HTTP methods using the configured instance
84
26
  export const post = ({url, data, config}: MethodData) =>
85
27
  instance.post(url, data, config);
@@ -1,15 +1,9 @@
1
1
  import {combineReducers} from '@reduxjs/toolkit';
2
2
  import {AppReducer} from './app/appSlice';
3
3
  import {UserReducer} from './user/userSlice';
4
- import {CategoriesReducer} from './Categories/categorySlice';
5
- import {ProvidersReducer} from './Providers/providersSlice';
6
- import {ServicesReducer} from './Services/servicesSlice';
7
4
  export const rootReducer = combineReducers({
8
5
  app: AppReducer,
9
6
  user: UserReducer,
10
- categories: CategoriesReducer,
11
- providers: ProvidersReducer,
12
- services: ServicesReducer,
13
7
  });
14
8
 
15
9
  export type RootState = ReturnType<typeof rootReducer>;