How to use farmos - 6 common examples

To help you get started, we’ve selected a few farmos 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 farmOS / farmOS-client / src / vue-plugins / login / module.js View on Github external
return new Promise((resolve) => {
        const farm = farmOS(url, username, password);
        farm.authenticate()
          .then((tokenResponse) => {
            // Save our username, password & token to the persistant store
            storage.setItem('host', url);
            storage.setItem('username', username);
            storage.setItem('password', password);
            storage.setItem('token', tokenResponse);

            // Go back 1 page, or reroute to home page
            if (window.history.length > 1) {
              window.history.back();
              resolve();
              return;
            }
            router.push('/');
            resolve();
github farmOS / farmOS-client / src / vue-plugins / login / module.js View on Github external
.catch(() => {
            // Check if the login attempt failed b/c it's http://, not https://
            const noSslUrl = `http://${payload.farmosUrl}`;
            const noSslfarm = farmOS(noSslUrl, username, password);
            noSslfarm.authenticate() // eslint-disable-line
              .then((tokenResponse) => {
                // Save our username, password & token to the persistant store
                storage.setItem('host', noSslUrl);
                storage.setItem('username', username);
                storage.setItem('password', password);
                storage.setItem('token', tokenResponse);

                // Go back 1 page, or reroute to home page
                if (window.history.length > 1) {
                  window.history.back();
                  resolve();
                  return;
                }
                router.push('/');
                resolve();
github farmOS / farmOS-client / src / core / store / authModule.js View on Github external
const lazyFarm = () => {
  const host = localStorage.getItem('host');
  const user = localStorage.getItem('username');
  const password = localStorage.getItem('password');
  return farmOS(host, user, password);
};
github farmOS / farmOS-client / src / data / httpModule.js View on Github external
const farm = () => {
  const host = localStorage.getItem('host');
  const user = localStorage.getItem('username');
  const password = localStorage.getItem('password');
  return farmOS(host, user, password);
};
github farmOS / farmOS-client / src / vue-plugins / login / module.js View on Github external
const lazyFarm = () => {
  const host = localStorage.getItem('host');
  const user = localStorage.getItem('username');
  const password = localStorage.getItem('password');
  return farmOS(host, user, password);
};
github farmOS / farmOS-client / src / core / store / http / module.js View on Github external
const farm = () => {
  const host = localStorage.getItem('host');
  const user = localStorage.getItem('username');
  const password = localStorage.getItem('password');
  return farmOS(host, user, password);
};

farmos

A JavaScript library for working with farmOS data structures and interacting with farmOS servers.

MIT
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis

Popular farmos functions