Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const [account, setAccount] = useState(defaultState);
const [submitting, setSubmitting] = useState(false);
// GraphQL
const createAccount = useMutation(CREATE_ACCOUNT_MUTATION, {
refetchQueries: [
{ query: ALL_ACCOUNTS_QUERY },
{
query: ALL_ACCOUNTS_BY_DOMAIN_QUERY,
variables: { domain }
},
{ query: COUNT_QUERY },
{ query: ALL_DOMAINS_QUERY }
]
});
const { data, loading, error } = useQuery(ALL_DOMAINS_QUERY, {
suspend: false
});
if (error) {
console.log(error);
return `Error!`;
}
const domains = data.domains
? data.domains.nodes
: [{ id: -1, domain: "Loading ..." }];
useEffect(
() => {
setAccount({ ...account, domain: domain || domains[0].domain });
},
export function use(
baseOptions?: ReactApolloHooks.QueryHookOptions,
) {
return ReactApolloHooks.useQuery(Document, baseOptions)
}
}
export function useQuery(options: QueryHookOptions) {
return ReactApolloHooks.useQuery(QUERY, options);
}
export function useQuery(options: QueryHookOptions) {
return ReactApolloHooks.useQuery(QUERY, options);
}
export function useQuery(options?: QueryHookOptions) {
return ReactApolloHooks.useQuery(QUERY, options);
}
export function useQuery(options: QueryHookOptions) {
return ReactApolloHooks.useQuery(QUERY, options);
}
export const useGetUsers = (options?) => {
useUserInfoChanged()
return useQuery(getUsersQuery, options)
}
export const useGetChats = (options?) => {
useChatAdded()
useChatInfoChanged()
return useQuery(getChatsQuery, options)
}
},
{ query: COUNT_QUERY }
]
});
const updateDomain = useMutation(UPDATE_DOMAIN_MUTATION, {
refetchQueries: [{ query: ALL_DOMAINS_QUERY }]
});
const deleteDomain = useMutation(DELETE_DOMAIN_MUTATION, {
refetchQueries: [
{
query: ALL_DOMAINS_QUERY
},
{ query: COUNT_QUERY }
]
});
const { data, loading, error } = useQuery(ALL_DOMAINS_QUERY, {
suspend: false
});
const showEditDomainHideCeateDomain = id => {
if (showCreateDomain) {
setShowCreateDomain(false);
}
setEditDomainId(id);
setShowEditDomain(true);
};
const showCreateDomainHideEditDomain = () => {
if (showEditDomain) {
setShowEditDomain(false);
}
setShowCreateDomain(true);
export default function Launches({
name,
limit,
offset,
match,
setTotalCount
}: RouteComponentProps & any) {
const {
data: {
shipsResult: {
data,
result: { totalCount }
}
},
error
} = useQuery(query, {
variables: {
name,
limit,
offset
}
});
setTotalCount(totalCount);
return error ? (
<span>{error}</span>
) : (
{data.map(({ id, name }) => (
<div>
⛴ {name}</div>