@autobusal/admin-agents 1.0.0 → 1.0.1

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/Browse.tsx CHANGED
@@ -3,7 +3,7 @@ import { useNavigate, useSearchParams } from 'react-router-dom';
3
3
  import { Meta, ContactInfo, Avatar, Table, Row } from '@autobusal/common';
4
4
  import { usePage } from '@autobusal/hooks';
5
5
  import { DisplayStatus, getParams, success } from '@autobusal/utilities';
6
- import { GetAgents, DeleteAgent } from './services';
6
+ import { useGetAgents, useDeleteAgent } from './services';
7
7
 
8
8
  interface Props {
9
9
  url: string
@@ -15,9 +15,9 @@ const Browse = ({ url, t }: Props): JSX.Element => {
15
15
 
16
16
  usePage('agents');
17
17
 
18
- const { data, isLoading, isFetching, refetch } = GetAgents(getParams(searchParams, ['page', 'sort', 'order', 'q']));
18
+ const { data, isLoading, isFetching, refetch } = useGetAgents(getParams(searchParams, ['page', 'sort', 'order', 'q']));
19
19
 
20
- const { mutate: Delete } = DeleteAgent();
20
+ const { mutate: Delete } = useDeleteAgent();
21
21
 
22
22
  const navigate = useNavigate();
23
23
 
package/Manage.tsx CHANGED
@@ -4,7 +4,7 @@ import { Meta, BackWithTitle, Viewer, IpLogs, ApiDetails } from '@autobusal/comm
4
4
  import { usePage, useSubscriptions, useOperators } from '@autobusal/hooks';
5
5
  import { GetStatus, getAllowed, success } from '@autobusal/utilities';
6
6
  import { AgentData } from '@autobusal/providers/types/agents';
7
- import { GetAgent, PostAgent, DeleteAgent } from './services';
7
+ import { useGetAgent, usePostAgent, useDeleteAgent } from './services';
8
8
 
9
9
  interface Props {
10
10
  url: string
@@ -25,11 +25,11 @@ const Manage = ({ url, t }: Props): JSX.Element => {
25
25
  const subscriptions = useSubscriptions('agent');
26
26
  const operators = useOperators();
27
27
 
28
- const { data } = GetAgent(id);
28
+ const { data } = useGetAgent(id);
29
29
 
30
- const { mutate: Update, isPending: isPendingSave } = PostAgent(id);
30
+ const { mutate: Update, isPending: isPendingSave } = usePostAgent(id);
31
31
 
32
- const { mutate: Delete, isPending: isPendingDelete } = DeleteAgent();
32
+ const { mutate: Delete, isPending: isPendingDelete } = useDeleteAgent();
33
33
 
34
34
  const onSave = (data: AgentData): void => {
35
35
  Update(data, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/admin-agents",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "main": "index.ts"
6
6
  }
package/services.ts CHANGED
@@ -4,7 +4,7 @@ import { PaginationData } from '@autobusal/providers/types/pagination';
4
4
  import { AgentData } from '@autobusal/providers/types/agents';
5
5
  import { TableParamsData } from '@autobusal/providers/types/other';
6
6
 
7
- export const GetAgents = (params: TableParamsData): UseQueryResult<PaginationData<AgentData>> => (
7
+ export const useGetAgents = (params: TableParamsData): UseQueryResult<PaginationData<AgentData>> => (
8
8
  useQuery({
9
9
  queryKey: ['admin-agents', params],
10
10
  queryFn: async () => (
@@ -17,7 +17,7 @@ export const GetAgents = (params: TableParamsData): UseQueryResult<PaginationDat
17
17
  })
18
18
  );
19
19
 
20
- export const GetAgent = (id: number): UseSuspenseQueryResult<AgentData> => (
20
+ export const useGetAgent = (id: number): UseSuspenseQueryResult<AgentData> => (
21
21
  useSuspenseQuery({
22
22
  queryKey: ['admin-agents-manage', { id }],
23
23
  queryFn: async () => {
@@ -36,7 +36,7 @@ export const GetAgent = (id: number): UseSuspenseQueryResult<AgentData> => (
36
36
  })
37
37
  );
38
38
 
39
- export const PostAgent = (id: number): UseMutationResult<void, Error, AgentData, unknown> => (
39
+ export const usePostAgent = (id: number): UseMutationResult<void, Error, AgentData, unknown> => (
40
40
  useMutation({
41
41
  mutationKey: ['admin-agents-save', { id }],
42
42
  mutationFn: async (data: AgentData) => {
@@ -72,7 +72,7 @@ export const PostAgent = (id: number): UseMutationResult<void, Error, AgentData,
72
72
  })
73
73
  );
74
74
 
75
- export const DeleteAgent = (): UseMutationResult<void, Error, number, unknown> => (
75
+ export const useDeleteAgent = (): UseMutationResult<void, Error, number, unknown> => (
76
76
  useMutation({
77
77
  mutationKey: ['admin-agents-delete'],
78
78
  mutationFn: async (id: number) => (