@autobusal/common 1.0.5 → 1.0.6

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,7 +3,7 @@ import { Paragraph } from '../index';
3
3
  import { success } from '@autobusal/utilities';
4
4
  import DevPos from './Devpos';
5
5
  import { DevPosForm } from './types';
6
- import { GetSettings, PostSettings } from './services';
6
+ import { useGetSettings, usePostSettings } from './services';
7
7
 
8
8
  interface Props {
9
9
  id: number
@@ -12,9 +12,9 @@ interface Props {
12
12
  }
13
13
 
14
14
  const Content = ({ id, type, t }: Props): JSX.Element => {
15
- const { data, isLoading } = GetSettings(id, type);
15
+ const { data, isLoading } = useGetSettings(id, type);
16
16
 
17
- const { mutate: SaveSettings, isPending } = PostSettings(id, type);
17
+ const { mutate: SaveSettings, isPending } = usePostSettings(id, type);
18
18
 
19
19
  if (isLoading) {
20
20
  return <Paragraph count={ 3 } />;
@@ -3,7 +3,7 @@ import { apiClient } from '@autobusal/providers';
3
3
  import { ApiDetailsData } from '@autobusal/providers/types/users';
4
4
  import { DevPosForm } from './types';
5
5
 
6
- export const GetSettings = (id: number, type: string): UseQueryResult<ApiDetailsData | string> => (
6
+ export const useGetSettings = (id: number, type: string): UseQueryResult<ApiDetailsData | string> => (
7
7
  useQuery({
8
8
  queryKey: ['apidetails-get-settings', { id, type }],
9
9
  queryFn: async () => (
@@ -21,7 +21,7 @@ export const GetSettings = (id: number, type: string): UseQueryResult<ApiDetails
21
21
  })
22
22
  );
23
23
 
24
- export const PostSettings = (id: number, type: string): UseMutationResult<void, Error, DevPosForm, unknown> => (
24
+ export const usePostSettings = (id: number, type: string): UseMutationResult<void, Error, DevPosForm, unknown> => (
25
25
  useMutation({
26
26
  mutationKey: ['apidetails-update-settings'],
27
27
  mutationFn: async (data: DevPosForm) => (
@@ -3,7 +3,7 @@ import { TFunction, i18n } from 'i18next';
3
3
  import { IoGlobeOutline } from 'react-icons/io5';
4
4
  import { useOutside } from '@autobusal/hooks';
5
5
  import { Container, Title, ContainerButtons, ButtonChange } from './styles';
6
- import { GetSettings } from '@autobusal/providers/services';
6
+ import { useGetSettings } from '@autobusal/providers/services';
7
7
 
8
8
  interface Props {
9
9
  type: 'top' | 'bottom'
@@ -15,7 +15,7 @@ interface Props {
15
15
  const ChangeLanguage = ({ type, t, i18n, onClose }: Props): JSX.Element => {
16
16
  const ref = useRef<HTMLDivElement>(null);
17
17
 
18
- const { data } = GetSettings();
18
+ const { data } = useGetSettings();
19
19
 
20
20
  useOutside(ref, onClose);
21
21
 
package/IpLogs/View.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TFunction } from 'i18next';
2
2
  import { Table, Row } from '../index';
3
3
  import { Container } from './styles';
4
- import { GetLogs } from './services';
4
+ import { useGetLogs } from './services';
5
5
 
6
6
  interface Props {
7
7
  id: number
@@ -11,7 +11,7 @@ interface Props {
11
11
  }
12
12
 
13
13
  const View = ({ id, page, type, t }: Props): JSX.Element => {
14
- const { data, isLoading, isFetching } = GetLogs(id, type, page);
14
+ const { data, isLoading, isFetching } = useGetLogs(id, type, page);
15
15
 
16
16
  const rows = data?.data.map(item => (
17
17
  <Row
@@ -3,7 +3,7 @@ import { apiClient } from '@autobusal/providers';
3
3
  import { LogData } from '@autobusal/providers/types/users';
4
4
  import { PaginationData } from '@autobusal/providers/types/pagination';
5
5
 
6
- export const GetLogs = (id: number, type: string, page: number): UseQueryResult<PaginationData<LogData>> => (
6
+ export const useGetLogs = (id: number, type: string, page: number): UseQueryResult<PaginationData<LogData>> => (
7
7
  useQuery({
8
8
  queryKey: ['ip-logs', { id, type, page }],
9
9
  queryFn: async () => {
package/Policy/Policy.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TFunction } from 'i18next';
2
2
  import Modal from '../Modal/Modal';
3
- import { GetPolicy } from './services';
3
+ import { useGetPolicy } from './services';
4
4
 
5
5
  interface Props {
6
6
  id: number
@@ -9,7 +9,7 @@ interface Props {
9
9
  }
10
10
 
11
11
  const Policy = ({ id, t, onClose }: Props): JSX.Element => {
12
- const { data, isFetching } = GetPolicy(id);
12
+ const { data, isFetching } = useGetPolicy(id);
13
13
 
14
14
  return (
15
15
  <Modal
@@ -2,7 +2,7 @@ import { useQuery, UseQueryResult } from '@tanstack/react-query';
2
2
  import { apiClient } from '@autobusal/providers';
3
3
  import { PolicyData } from '@autobusal/providers/types/routes';
4
4
 
5
- export const GetPolicy = (id: number): UseQueryResult<PolicyData> => (
5
+ export const useGetPolicy = (id: number): UseQueryResult<PolicyData> => (
6
6
  useQuery({
7
7
  queryKey: ['route-policy', { id }],
8
8
  queryFn: async () => (
package/Report/Send.tsx CHANGED
@@ -5,7 +5,7 @@ import { Button } from '../index';
5
5
  import { Validate, Display } from '@autobusal/utilities';
6
6
  import { Success } from './styles';
7
7
  import { ReportForm } from './types';
8
- import { PostReport } from './services';
8
+ import { usePostReport } from './services';
9
9
 
10
10
  interface Props {
11
11
  type: string
@@ -15,7 +15,7 @@ interface Props {
15
15
  const Send = ({ type, t }: Props): JSX.Element => {
16
16
  const { register, handleSubmit, formState: { errors } } = useForm<ReportForm>();
17
17
 
18
- const { mutate: Send, isPending, isSuccess } = PostReport(type);
18
+ const { mutate: Send, isPending, isSuccess } = usePostReport(type);
19
19
 
20
20
  const onSubmit = (data: ReportForm): void => {
21
21
  Send(data);
@@ -2,7 +2,7 @@ import { UseMutationResult, useMutation } from '@tanstack/react-query';
2
2
  import { apiClient } from '@autobusal/providers';
3
3
  import { ReportForm } from './types';
4
4
 
5
- export const PostReport = (type: string): UseMutationResult<void, Error, ReportForm, unknown> => (
5
+ export const usePostReport = (type: string): UseMutationResult<void, Error, ReportForm, unknown> => (
6
6
  useMutation({
7
7
  mutationKey: ['operator-locations-move', { type }],
8
8
  mutationFn: async (data: ReportForm) => (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "main": "index.ts"
6
6
  }