Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
appearance: 'success',
autoDismiss: true,
})
},
refetchQueries: [refetchOptions],
})
const [renameFolder] = useMutation(RENAME_FOLDER, {
onCompleted: ({ renameFolder }) => {
addToast(renameFolder.message, {
appearance: 'success',
autoDismiss: true,
})
},
refetchQueries: [refetchOptions],
})
const [openFileQuery] = useLazyQuery(OPEN_FILE, {
onCompleted: () => {
addToast('Opened file in editor!', {
appearance: 'success',
autoDismiss: true,
})
},
})
const openFile = () => {
openFileQuery({
variables: {
path: item.path,
},
})
}
const Detail = ({ match, history }) => {
const [user, setUser] = useState();
const [project, setProject] = useState();
const [isLiked, setIsLiked] = useState();
const [addView] = useMutation(ADD_VIEW);
const [likeCount, setLikeCount] = useState();
const [ready, setReady] = useState(false);
const [me] = useLazyQuery(ME, {
onCompleted(res) {
if (res.me) {
setUser(res.me);
}
},
});
const [loadProject] = useLazyQuery(LOAD_PROJECT, {
onCompleted(res) {
if (!res.findProjectById) {
history.goBack();
} else {
const projectData = res.findProjectById;
setProject(res.findProjectById);
setIsLiked(res.findProjectById.isLiked);
setLikeCount(res.findProjectById.likeCount);
images = [];
const render = workspaceList.workspaces[0].setRender;
workspaceList.workspaces = [];
workspaceList.images = [];
workspaceList.dropdownItems.sprite = { wall: '벽' };
projectData.workspaces.forEach((ws) => {
const newWorkSpace = new Workspace({
setRender: render, id: ws.id, imageId: ws.images[0].id,
export function useCurrentUserLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) {
return ApolloReactHooks.useLazyQuery(CurrentUserDocument, baseOptions);
}
export type CurrentUserQueryHookResult = ReturnType;
export function useGetRunsFeedLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) {
return ApolloReactHooks.useLazyQuery(GetRunsFeedDocument, baseOptions);
}
export type GetRunsFeedQueryHookResult = ReturnType;
const MessageScreen: React.FC = () => {
const { navigate } = useNavigation();
const { user, theme } = useContext(AppContext);
const [queryChats, { called, data, loading, error }] = useLazyQuery(QUERY_CHATS, {
variables: { userId: user.id },
fetchPolicy: 'network-only',
pollInterval: PollIntervals.messages
});
const [createTemporaryChat] = useMutation(MUTATION_CREATE_TEMPORARY_CHAT);
const [chatSearch, setChatSearch] = useState('');
const newMessageBottomSheetRef = useRef();
useEffect(() => {
queryChats();
}, []);
const renderItem = ({ item }) => {
export function useMeLazyQuery(
baseOptions?: ApolloReactHooks.LazyQueryHookOptions<
MeQuery,
MeQueryVariables
>,
) {
return ApolloReactHooks.useLazyQuery(
MeDocument,
baseOptions,
)
}
const [token, setToken] = useState('')
const [attendance, setAttendance] = useState('INIT')
const [attendEvent, { attendEventData }] = useMutation(ATTEND_EVENT, {
context: {
headers: {
authorization: 'bearer ' + token
}
},
onCompleted(data) {
if (data.attendEvent.status) {
setAttendance(data.attendEvent.status)
}
}
})
const { loading, error, data } = useQuery(EVENTS)
const [getAttendanceStatus, attendanceMeta] = useLazyQuery(ATTENDING, {
context: {
headers: {
authorization: 'bearer ' + token
}
},
onCompleted(data) {
if (
data.upcoming &&
data.upcoming.length !== 0 &&
data.upcoming[0].attendance
) {
setAttendance(data.upcoming[0].attendance.status)
}
}
})
const FOLLOW_LIST = gql`
query FollowList($myId: Int!, $userId: Int!) {
followList(myId: $myId, userId: $userId) {
id
name
username
profileImage
isFollow
}
}
`;
const lazyQueryOption = {
variables: { myId, userId: data.id },
fetchPolicy: 'cache-and-network',
};
const [loadFollowerList, followerResult] = useLazyQuery(
FOLLOWER_LIST,
lazyQueryOption,
);
const [loadFollowList, followResult] = useLazyQuery(
FOLLOW_LIST,
lazyQueryOption,
);
const [isFollowerModalVisible, setIsFollowerModalVisible] = useState(false);
const [isFollowModalVisible, setIsFollowModalVisible] = useState(false);
const onFollowerClick = async () => {
await loadFollowerList();
setIsFollowerModalVisible(curVisibleState => !curVisibleState);
};
const onFollowClick = async () => {
export default function useStars() {
const [loading, setLoading] = useState(false);
const [finished, setFinished] = useState(false);
const [repo, setRepo] = useState(null);
const [data, setData] = useState(undefined);
const [loadStars, { called, data: pageData, variables, error }] = useLazyQuery(GetStars);
useEffect(() => {
if (pageData) {
setLoading(true);
const { stargazers } = pageData.repository;
const { edges, totalCount } = stargazers;
const { hasNextPage, endCursor } = stargazers.pageInfo;
setData((oldData = {}) => {
const tmpObj = {};
edges.forEach(({ node, starredAt }) => {
let dateObj = new Date(starredAt);
let keyVal = `${dateObj.toLocaleDateString(navigator.language, {
month: '2-digit',
day: '2-digit',
year: 'numeric'
})}`;
actions: [NavigationActions.navigate({ routeName: 'SignedIn' })],
});
navigation.dispatch(resetAction);
},
onError: () => {
showMessage({
message: 'Erro ao buscar sua localização!',
description:
'Ops! Você acredita que o gatinho quase quebrou o GPS? Tente liga-lo novamente.',
type: 'danger',
});
setLoading(false);
},
});
const [getLocalization] = useLazyQuery(GET_LOCALIZATION, {
onCompleted: ({ localization }) => {
setLocalization(localization);
setLoading(false);
},
});
function getLocation() {
setLoading(true);
Geolocation.getCurrentPosition(
(position) => {
const { coords } = position;
getLocalization({
variables: {
latitude: coords.latitude,
longitude: coords.longitude,
},