Fix according to PR
This commit is contained in:
@ -37,7 +37,7 @@ jest.mock('@apollo/client', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
error: {},
|
error: null,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
export const useHasAccessToken = () => {
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
export const redirectToSignIn = () => {
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
@ -15,18 +15,18 @@ export const GET_TOKEN = gql`
|
|||||||
|
|
||||||
export const useRefreshToken = () => {
|
export const useRefreshToken = () => {
|
||||||
const refreshToken = localStorage.getItem('refreshToken');
|
const refreshToken = localStorage.getItem('refreshToken');
|
||||||
const { data, loading } = useQuery(GET_TOKEN, {
|
const { data, loading, error } = useQuery(GET_TOKEN, {
|
||||||
client: authClient,
|
client: authClient,
|
||||||
variables: { input: { refreshToken } },
|
variables: { input: { refreshToken } },
|
||||||
});
|
});
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!loading) {
|
if (!loading && !error) {
|
||||||
const accessToken = data.token.accessToken;
|
const accessToken = data.token.accessToken;
|
||||||
if (refreshToken && accessToken) {
|
if (accessToken) {
|
||||||
localStorage.setItem('accessToken', accessToken || '');
|
localStorage.setItem('accessToken', accessToken || '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [data, refreshToken, loading]);
|
}, [data, refreshToken, loading, error]);
|
||||||
|
|
||||||
return { loading };
|
return { loading, error };
|
||||||
};
|
};
|
||||||
|
|||||||
@ -14,8 +14,8 @@ const StyledPeopleContainer = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const GET_PEOPLE = gql`
|
export const GET_PEOPLE = gql`
|
||||||
query GetPeople($orderBy: [persons_order_by!]) {
|
query GetPeople($orderBy: [people_order_by!]) {
|
||||||
persons(order_by: $orderBy) {
|
people(order_by: $orderBy) {
|
||||||
id
|
id
|
||||||
phone
|
phone
|
||||||
email
|
email
|
||||||
@ -57,7 +57,7 @@ function People() {
|
|||||||
setOrderBy(sorts.length ? reduceSortsToOrderBy(sorts) : defaultOrderBy);
|
setOrderBy(sorts.length ? reduceSortsToOrderBy(sorts) : defaultOrderBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = useQuery<{ persons: GraphqlPerson[] }>(GET_PEOPLE, {
|
const { data } = useQuery<{ people: GraphqlPerson[] }>(GET_PEOPLE, {
|
||||||
variables: { orderBy: orderBy },
|
variables: { orderBy: orderBy },
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ function People() {
|
|||||||
<StyledPeopleContainer>
|
<StyledPeopleContainer>
|
||||||
{
|
{
|
||||||
<Table
|
<Table
|
||||||
data={data ? data.persons.map(mapPerson) : []}
|
data={data ? data.people.map(mapPerson) : []}
|
||||||
columns={peopleColumns}
|
columns={peopleColumns}
|
||||||
viewName="All People"
|
viewName="All People"
|
||||||
viewIcon={faList}
|
viewIcon={faList}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ const mocks = [
|
|||||||
},
|
},
|
||||||
result: {
|
result: {
|
||||||
data: {
|
data: {
|
||||||
persons: defaultData,
|
people: defaultData,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
25
hasura/metadata/databases/default/tables/public_people.yaml
Normal file
25
hasura/metadata/databases/default/tables/public_people.yaml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
table:
|
||||||
|
name: people
|
||||||
|
schema: public
|
||||||
|
object_relationships:
|
||||||
|
- name: company
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: company_id
|
||||||
|
- name: workspace
|
||||||
|
using:
|
||||||
|
foreign_key_constraint_on: workspace_id
|
||||||
|
select_permissions:
|
||||||
|
- role: user
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- company_id
|
||||||
|
- id
|
||||||
|
- workspace_id
|
||||||
|
- city
|
||||||
|
- email
|
||||||
|
- firstname
|
||||||
|
- lastname
|
||||||
|
- phone
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
filter: {}
|
||||||
@ -7,5 +7,5 @@
|
|||||||
- "!include auth_user_security_keys.yaml"
|
- "!include auth_user_security_keys.yaml"
|
||||||
- "!include auth_users.yaml"
|
- "!include auth_users.yaml"
|
||||||
- "!include public_companies.yaml"
|
- "!include public_companies.yaml"
|
||||||
- "!include public_persons.yaml"
|
- "!include public_people.yaml"
|
||||||
- "!include public_workspaces.yaml"
|
- "!include public_workspaces.yaml"
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
alter table "public"."people" rename to "persons";
|
||||||
@ -0,0 +1 @@
|
|||||||
|
alter table "public"."persons" rename to "people";
|
||||||
Reference in New Issue
Block a user