@autobusal/providers 1.1.1 → 1.1.2
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/Errors/Message.tsx +2 -2
- package/Notifications/Notifications.tsx +2 -2
- package/Setup/Setup.tsx +3 -3
- package/Styles/Styles.tsx +2 -2
- package/package.json +1 -1
- package/services.ts +2 -2
package/Errors/Message.tsx
CHANGED
|
@@ -4,14 +4,14 @@ import { useSystemTheme } from '@autobusal/hooks';
|
|
|
4
4
|
import { getLanguage } from '../Setup/languages';
|
|
5
5
|
import errors from '@lang/errors';
|
|
6
6
|
import { Background, Container, Logo, Description } from './styles';
|
|
7
|
-
import {
|
|
7
|
+
import { useGetSettings } from '../services';
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
type: 'error' | 'not_found'
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const Message = ({ type }: Props): JSX.Element => {
|
|
14
|
-
const { data } =
|
|
14
|
+
const { data } = useGetSettings();
|
|
15
15
|
|
|
16
16
|
const theme = useSystemTheme();
|
|
17
17
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Toaster } from 'react-hot-toast';
|
|
2
2
|
import { useSystemTheme } from '@autobusal/hooks';
|
|
3
|
-
import {
|
|
3
|
+
import { useGetSettings } from '../services';
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
children: JSX.Element
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export const Provider = ({ children }: Props): JSX.Element => {
|
|
10
|
-
const { data } =
|
|
10
|
+
const { data } = useGetSettings();
|
|
11
11
|
|
|
12
12
|
const mode = useSystemTheme();
|
|
13
13
|
|
package/Setup/Setup.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Preload from './Preload';
|
|
2
2
|
import languages from './languages';
|
|
3
3
|
import analytics from './analytics';
|
|
4
|
-
import {
|
|
4
|
+
import { useGetSettings, useGetMenu } from '../services';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
type: 'normal' | 'whitelabel'
|
|
@@ -9,9 +9,9 @@ interface Props {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const Setup = ({ type, children }: Props): JSX.Element => {
|
|
12
|
-
const { data } =
|
|
12
|
+
const { data } = useGetSettings();
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
useGetMenu();
|
|
15
15
|
|
|
16
16
|
languages(type, data.preferences.languages.default);
|
|
17
17
|
|
package/Styles/Styles.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ThemeProvider } from 'styled-components';
|
|
2
2
|
import { useSystemTheme } from '@autobusal/hooks';
|
|
3
3
|
import GlobalStyles from './GlobalStyles';
|
|
4
|
-
import {
|
|
4
|
+
import { useGetSettings } from '../services';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
children: JSX.Element
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const Styles = ({ children }: Props): JSX.Element => {
|
|
11
|
-
const { data } =
|
|
11
|
+
const { data } = useGetSettings();
|
|
12
12
|
|
|
13
13
|
const mode = useSystemTheme();
|
|
14
14
|
|
package/package.json
CHANGED
package/services.ts
CHANGED
|
@@ -3,7 +3,7 @@ import apiClient from './Queries/apiClient';
|
|
|
3
3
|
import { SettingsData, MenuData } from './types/settings';
|
|
4
4
|
import useMenuStore from './stores/menu';
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const useGetSettings = (): UseSuspenseQueryResult<SettingsData> => (
|
|
7
7
|
useSuspenseQuery({
|
|
8
8
|
queryKey: ['get-settings'],
|
|
9
9
|
queryFn: async () => (
|
|
@@ -17,7 +17,7 @@ export const GetSettings = (): UseSuspenseQueryResult<SettingsData> => (
|
|
|
17
17
|
})
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
export const
|
|
20
|
+
export const useGetMenu = (): UseSuspenseQueryResult<MenuData> => {
|
|
21
21
|
const menuStore = useMenuStore();
|
|
22
22
|
|
|
23
23
|
return useSuspenseQuery({
|