How to use the @reach/router.useNavigate function in @reach/router

To help you get started, we’ve selected a few @reach/router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seashell / drago / ui / src / views / networks / details / index.js View on Github external
const NetworkDetails = () => {
  const location = useLocation()
  const navigate = useNavigate()
  const { networkId } = useParams()

  const { confirm } = useConfirmationDialog()

  const [isAdmitNodeModalOpen, setAdmitNodeModalOpen] = useState(false)

  const getNetworkQuery = useQuery(GET_NETWORK_WITH_INTERFACES, {
    variables: { id: networkId },
  })

  const [createInterface, createInterfaceMutation] = useMutation(CREATE_INTERFACE, {
    variables: { networkId },
  })

  const [deleteInterface, deleteInterfaceMutation] = useMutation(DELETE_INTERFACE)
github seashell / drago / ui / src / views / links / details / index.js View on Github external
const LinkDetailsView = () => {
  const navigate = useNavigate()
  const location = useLocation()
  const urlParams = useParams()

  const { hostId } = location.state || {}

  const formik = useFormik({
    initialValues: {
      fromInterfaceId: null,
      toInterfaceId: null,
      allowedIps: [],
      persistentKeepalive: null,
    },
    validationSchema: Yup.object().shape({
      fromInterfaceId: Yup.string()
        .required()
        .nullable(),
github seashell / drago / ui / src / views / interfaces / details / index.js View on Github external
const InterfaceDetailsView = () => {
  const navigate = useNavigate()
  const location = useLocation()
  const urlParams = useParams()

  const { hostId } = location.state || {}

  if (hostId === undefined) {
    navigate(`/ui/hosts`)
  }

  const formik = useFormik({
    initialValues: {
      name: null,
      networkId: null,
      ipAddress: null,
      listenPort: null,
    },
github seashell / drago / ui / src / views / interfaces / new / index.js View on Github external
const NewInterfaceView = () => {
  const navigate = useNavigate()
  const location = useLocation()

  const { hostId } = location.state || {}

  const formik = useFormik({
    initialValues: {
      name: null,
      networkId: null,
      ipAddress: null,
      listenPort: null,
    },
    validationSchema: Yup.object().shape({
      name: Yup.string()
        .required()
        .nullable(),
      networkId: Yup.string().nullable(),
github seashell / drago / ui / src / views / hosts / details / links-tab / index.js View on Github external
const HostLinksTab = ({ hostId }) => {
  const navigate = useNavigate()
  const location = useLocation()

  const [searchFilter, setSearchFilter] = useState('')

  const getHostLinksQuery = useQuery(GET_LINKS, {
    variables: { fromHostId: hostId },
  })

  const [deleteLink, deleteLinkLinksMutation] = useMutation(DELETE_LINK, {
    variables: { id: undefined },
  })

  useEffect(() => {
    getHostLinksQuery.refetch()
  }, [location, getHostLinksQuery])
github seashell / drago / ui / src / views / networks / new / index.js View on Github external
const NewNetwork = () => {
  const navigate = useNavigate()
  const { success, error } = useToast()

  const formik = useFormik({
    initialValues: {
      name: '',
      addressRange: '',
    },
    validationSchema: Yup.object().shape({
      name: Yup.string().required().nullable(),
      addressRange: Yup.string().required().nullable(),
    }),
  })

  const [createNetwork, createNetworkMutation] = useMutation(CREATE_NETWORK, {
    variables: {},
    onCompleted: () => {
github seashell / drago / ui / src / views / hosts / details / attributes-tab / index.js View on Github external
const HostAttributesTab = () => {
  const navigate = useNavigate()
  const location = useLocation()
  const urlParams = useParams()

  const formik = useFormik({
    initialValues: {
      name: null,
      labels: [],
      advertiseAddress: null,
    },
    validationSchema: Yup.object().shape({
      name: Yup.string()
        .required()
        .nullable(),
      advertiseAddress: Yup.string().nullable(),
    }),
  })
github seashell / drago / ui / src / views / links / new / index.js View on Github external
const NewLinkView = () => {
  const navigate = useNavigate()
  const location = useLocation()

  const { hostId } = location.state || {}

  const [selectedNetworkId, setSelectedNetworkId] = useState('')
  const [selectedHostId, setSelectedHostId] = useState('')

  const formik = useFormik({
    initialValues: {
      fromInterfaceId: null,
      toInterfaceId: null,
      allowedIps: [],
      persistentKeepalive: null,
    },
    validationSchema: Yup.object().shape({
      fromInterfaceId: Yup.string()
github seashell / drago / ui / src / views / hosts / new / index.js View on Github external
const NewHostView = ({ networkId }) => {
  const navigate = useNavigate()

  const formik = useFormik({
    initialValues: {
      name: null,
      labels: [],
      advertiseAddress: null,
    },
    validationSchema: Yup.object().shape({
      name: Yup.string()
        .required()
        .nullable(),
      advertiseAddress: Yup.string().nullable(),
    }),
  })

  const [createHost, createHostMutation] = useMutation(CREATE_HOST, {