How to use actions - 10 common examples

To help you get started, we’ve selected a few actions 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 web-pal / chronos-timetracker / app / sagas / auth.js View on Github external
const { payload } = yield take(actionTypes.LOGIN_REQUEST);
      const host = yield call(transformValidHost, payload.host);
      const protocol = host.protocol.slice(0, -1);

      yield put(authActions.addAuthDebugMessage([
        { string: 'Login request...' },
        { string: `host: ${host.hostname}` },
        { string: `protocol: ${protocol}` },
        { string: `port: ${host.port}` },
        { string: `path_prefix: ${host.pathname}` },
        { string: `username: ${payload.username}` },
        { string: 'password: ***' },
      ]));

      yield put(uiActions.setUiState('loginRequestInProcess', true));
      yield put(uiActions.setUiState('loginError', null));
      yield call(
        jira.basicAuth,
        {
          ...payload,
          host: host.hostname,
          protocol,
          port: host.port,
          path_prefix: host.pathname,
        },
      );
      // Test request for check auth
      const {
        debug,
        result,
      } = yield call(Api.jiraProfile, true);
      yield put(authActions.addAuthDebugMessage([
github junlico / dragalia-lost / src / views / StatsCalc / StatsCol / StatsField / StatsAvatar.js View on Github external
render() {
    let { lang, image, name, statsKey, scale } = this.props;

    const field = getField(statsKey);
    const label = name ? name[lang] : translate(statsKey, lang);
    const cn = classNames('avatar center', { scale });
    return (
      <div>
        <img size="lg">
        <div>{label}</div>
      </div>
    );
  }
github junlico / dragalia-lost / src / views / StatsCalc / SetCol / SelectStats / StatsList / ListHeader.js View on Github external
{fields.map(f =&gt; {
        if (f === 'rarity') {
          return (
            <div>
              {translate('rarity', lang)}
            </div>
          );
        }

        return <div>;
      })}
    </div>
github junlico / dragalia-lost / src / views / SelectStats / ListHeader.jsx View on Github external
{fields.map((field) =&gt; {
          if (field === "rarity") {
            return (
              <div>
                {translate("rarity", lang)}
              </div>
            );
          }

          return (
            <div>
            </div>
          );
        })}
github junlico / dragalia-lost / src / views / StatsCalc / DetailsCol / StatsDetails.jsx View on Github external
{rows.map((row) =&gt; {
              let { HP = 0, STR = 0, might = 0 } = details[row] || {};
              return (
                <div>
                  <div>{translate(row, lang)}</div>
                  <div>{HP}</div>
                  <div>{STR}</div>
                  <div>{might}</div>
                </div>
              );
            })}
github junlico / dragalia-lost / src / views / StatsCalc / DetailCol / StatsDetail / StatsDetail.js View on Github external
rows.map(row =&gt; {
                    const { HP, STR, might } = details[row];
                    return (
                      
                        {translate(row, lang)}
                        {HP}
                        {STR}
                        {might}
                      
                    );
                  })}
github web-pal / chronos-timetracker / app / renderer / sagas / auth.js View on Github external
baseUrl: href.replace(/\/$/, ''),
      });
      yield eff.put(authActions.authRequest({
        protocol,
        hostname,
        port,
        pathname,
        cookies,
      }));
    } catch (err) {
      if (err && err.message) {
        yield eff.put(uiActions.setUiState({
          authError: err.message,
        }));
      } else {
        yield eff.put(uiActions.setUiState(
          'authError',
          'Can not authenticate user. Please try again',
        ));
      }
      yield eff.call(throwError, err);
      yield eff.put(uiActions.setUiState({
        authRequestInProcess: false,
      }));
    }
  }
}
github web-pal / chronos-timetracker / app / renderer / sagas / filters.js View on Github external
},
            } : {}
        ),
        body: {
          ...data,
          jql,
        },
      },
    );
    yield eff.fork(notify, {
      title: `Save filter ${filter.name}`,
    });
    yield eff.put(actions.succeeded({
      resources: [filter],
    }));
    yield eff.put(uiActions.setUiState({
      saveFilterDialogOpen: false,
      issuesSourceId: filter.id,
      filterStatusesIsFetched: false,
    }));
    yield eff.put(resourcesActions.clearResourceList({
      resourceType: 'issues',
      list: 'recentIssues',
    }));
    yield eff.put(issuesActions.refetchIssuesRequest());
  } catch (err) {
    throwError(err);
    yield eff.put(actions.failed());
    const errObj = JSON.parse(err);
    if (errObj.body.errorMessages.length > 0) {
      yield eff.fork(notify, {
        title: 'Failed to save filter',
github web-pal / chronos-timetracker / app / renderer / sagas / initialize.js View on Github external
export function* initializeApp(): Generator&lt;*, *, *&gt; {
  yield eff.put(uiActions.setUiState({
    initializeInProcess: true,
  }));
  try {
    const accounts = yield eff.call(
      getElectronStorage,
      'accounts',
      [],
    );
    yield eff.put(uiActions.setUiState({
      accounts,
    }));
    const authCredentials = yield eff.call(
      getElectronStorage,
      'last_used_account',
    );
    const authDataExist = (
github web-pal / chronos-timetracker / app / sagas / auth.js View on Github external
);
      yield put(uiActions.setUiState('loginRequestInProcess', false));
      trackMixpanel('Jira login');
      incrementMixpanel('Jira login', 1);
    } catch (err) {
      if (err.debug) {
        err.debug.options.auth.password = '***';
        err.debug.request.headers.authorization = '***';
        yield put(authActions.addAuthDebugMessage([
          {
            json: err.debug,
          },
        ]));
      }
      yield put(uiActions.setUiState('loginRequestInProcess', false));
      yield put(uiActions.setUiState(
        'loginError',
        'Can not authenticate user. Please try again',
      ));
      yield call(throwError, err.result ? err.result : err);
    }
  }
}

actions

Actions for a resourceful controller, CRUD

MIT
Latest version published 10 years ago

Package Health Score

47 / 100
Full package analysis