How to use @inertiajs/inertia - 10 common examples

To help you get started, we’ve selected a few @inertiajs/inertia 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 laravelcm / website / resources / assets / ts / pages / user / Forms / Profile.tsx View on Github external
const onDrop = useCallback((acceptedFiles) => {
    const selectFile = acceptedFiles[0];
    setPicture(URL.createObjectURL(selectFile));

    // Upload file to the server.
    const formData = new FormData();
    formData.append('avatar_location', selectFile);
    Inertia.post(`/profile/avatar`, formData);
  }, []);
  const inputClass = classNames('form-input flex-1 block w-full focus:shadow-outline-brand focus:border-brand-200 rounded-none rounded-r-md transition duration-150 ease-in-out sm:text-sm sm:leading-5', {
github laravelcm / website / resources / assets / ts / pages / forum / ThreadModal.tsx View on Github external
const form = {
      ...values,
      body,
    };

    if (thread) {
      Inertia.put(`/forum/threads/${id}`, form).then(() => {
        setSending(false);
        onClose();
        window.location.reload();
      }).catch((error) => {
        console.error(error);
      });
    } else {
      Inertia.post(`/forum/threads`, form).then(() => {
        setSending(false);
      }).catch((error) => {
        console.error(error);
      });
    }
  }
github laravelcm / website / resources / assets / ts / pages / auth / Register.tsx View on Github external
function handleSubmit(e: React.SyntheticEvent) {
    e.preventDefault();
    if (!isRobot) {
      setSending(true);
      Inertia.post("/register", values).then(() => {
        setSending(false);
      });
    }
  }
github laravelcm / website / resources / assets / ts / pages / auth / Email.tsx View on Github external
function handleSubmit(e: React.SyntheticEvent) {
    e.preventDefault();
    setSending(true);
    Inertia.post("/password/email", { email }).then(() => {
      setSending(false);
      setEmail("");
    });
  }
github laravelcm / website / resources / assets / ts / pages / auth / Login.tsx View on Github external
function handleSubmit(e: React.SyntheticEvent) {
    e.preventDefault();
    setSending(true);
    Inertia.post("/login", values).then(() => {
      setSending(false);
    });
  }
github laravelcm / website / resources / assets / ts / pages / auth / Reset.tsx View on Github external
function handleSubmit(e: React.SyntheticEvent) {
    e.preventDefault();
    setSending(true);
    Inertia.post("/password/reset", values).then(() => {
      setSending(false);
    });
  }
github laravelcm / website / resources / assets / ts / pages / forum / ThreadModal.tsx View on Github external
function manageThread(e: React.SyntheticEvent) {
    e.preventDefault();
    setSending(true);

    const form = {
      ...values,
      body,
    };

    if (thread) {
      Inertia.put(`/forum/threads/${id}`, form).then(() => {
        setSending(false);
        onClose();
        window.location.reload();
      }).catch((error) => {
        console.error(error);
      });
    } else {
      Inertia.post(`/forum/threads`, form).then(() => {
        setSending(false);
      }).catch((error) => {
        console.error(error);
      });
    }
  }
github laravelcm / website / resources / assets / ts / pages / user / Forms / Profile.tsx View on Github external
function handleSubmit(e: React.SyntheticEvent) {
    e.preventDefault();
    setSending(true);
    Inertia.put('/profile/profile', values).then(() => {
      setSending(false);
    });
  }
github laravelcm / website / resources / assets / ts / pages / user / Forms / PersonalData.tsx View on Github external
function handleSubmit(e: React.SyntheticEvent) {
    e.preventDefault();
    setSending(true);
    const data = {
      ...values,
      ...locations,
    };

    Inertia.put('/profile/update', data).then(() => {
      setSending(false);
    });
  }
github laravelcm / website / resources / assets / ts / utils / helpers.tsx View on Github external
export const navigate = (e: SyntheticEvent, url: string, options?: object) => {
  e.stopPropagation();
  Inertia.visit(url, { method: "get", ...options });
};

@inertiajs/inertia

A framework for creating server-driven single page apps.

MIT
Latest version published 2 years ago

Package Health Score

66 / 100
Full package analysis

Similar packages