@autobusal/providers 1.0.2 → 1.0.3
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/Setup/Setup.tsx +3 -1
- package/package.json +7 -7
- package/services.ts +15 -1
- package/types.ts +8 -0
package/Setup/Setup.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Preload from './Preload';
|
|
2
2
|
import languages from './utilities/languages';
|
|
3
3
|
import analytics from './utilities/analytics';
|
|
4
|
-
import { GetSettings } from '../services';
|
|
4
|
+
import { GetSettings, GetMenu } from '../services';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
type: 'normal' | 'whitelabel'
|
|
@@ -11,6 +11,8 @@ interface Props {
|
|
|
11
11
|
const Setup = ({ type, children }: Props): JSX.Element => {
|
|
12
12
|
const { data } = GetSettings();
|
|
13
13
|
|
|
14
|
+
GetMenu();
|
|
15
|
+
|
|
14
16
|
languages(type, data.preferences.languages.default);
|
|
15
17
|
|
|
16
18
|
analytics(data.preferences.googleAnalyticsID);
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autobusal/providers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@tanstack/react-query": "^5.
|
|
8
|
-
"axios": "^1.5
|
|
9
|
-
"i18next": "^23.
|
|
10
|
-
"i18next-http-backend": "^2.
|
|
7
|
+
"@tanstack/react-query": "^5.17.19",
|
|
8
|
+
"axios": "^1.6.5",
|
|
9
|
+
"i18next": "^23.7.18",
|
|
10
|
+
"i18next-http-backend": "^2.4.2",
|
|
11
11
|
"react-ga4": "^2.1.0",
|
|
12
12
|
"react-helmet": "^6.1.0",
|
|
13
13
|
"react-hot-toast": "^2.4.1",
|
|
14
|
-
"react-i18next": "^
|
|
15
|
-
"styled-components": "^6.1.
|
|
14
|
+
"react-i18next": "^14.0.1",
|
|
15
|
+
"styled-components": "^6.1.8"
|
|
16
16
|
}
|
|
17
17
|
}
|
package/services.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSuspenseQuery, UseSuspenseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import apiClient from './Queries/apiClient';
|
|
3
|
-
import { SettingsData } from './types';
|
|
3
|
+
import { SettingsData, MenuData } from './types';
|
|
4
4
|
|
|
5
5
|
export const GetSettings = (): UseSuspenseQueryResult<SettingsData> => (
|
|
6
6
|
useSuspenseQuery({
|
|
@@ -15,4 +15,18 @@ export const GetSettings = (): UseSuspenseQueryResult<SettingsData> => (
|
|
|
15
15
|
),
|
|
16
16
|
staleTime: Infinity
|
|
17
17
|
})
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const GetMenu = (): UseSuspenseQueryResult<MenuData> => (
|
|
21
|
+
useSuspenseQuery({
|
|
22
|
+
queryKey: ['get-menu'],
|
|
23
|
+
queryFn: async () => (
|
|
24
|
+
await apiClient
|
|
25
|
+
.get('/api/menu/get')
|
|
26
|
+
.then(response => (
|
|
27
|
+
response.data
|
|
28
|
+
))
|
|
29
|
+
.catch(() => {})
|
|
30
|
+
)
|
|
31
|
+
})
|
|
18
32
|
);
|