Skip to content

Instantly share code, notes, and snippets.

View tlaitinen's full-sized avatar

Tero Laitinen tlaitinen

View GitHub Profile
const {actionChannel} = require('redux-saga/effects');
// const {buffers} = require('redux-saga');
const {createStore, applyMiddleware} = require('redux');
const reduxSaga = require('redux-saga');
const sagaMiddleware = reduxSaga.default();
const store = createStore((state={}) => state, applyMiddleware(sagaMiddleware));
sagaMiddleware.run(function* () {
import React from 'react';
import {
typedConnect,
createPropsMapper,
PropsOf
} from 'react-redux-typed-connect';
export function makeTestComponent<E,RS>(getEntity:(state:RS, id:string) => E | undefined) {
import React from 'react';
import {
typedConnect,
createPropsMapper,
PropsOf
} from 'react-redux-typed-connect';
export function makeTestComponent<E,RS>(getEntity:(state:RS, id:string) => E | undefined) {
import AWS from 'aws-sdk';
import cfg from '../config';
import archiver from 'archiver';
import {Archiver} from 'archiver';
const s3 = new AWS.S3({
region: cfg.awsRegion,
signatureVersion: 'v4'
});
export type ObjectKeyWithPath = {
package fi.example.app;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Environment;
import React from 'react';
import {
typedConnect,
createPropsMapper,
PropsOf
} from 'react-redux-typed-connect';
import SearchBar from '../components/search-bar';
import {Selectors, Actions} from '../actions/crud';
import * as qn from '../actions/crud-query-names';
export interface CreateCrudSearchBar<C,E,Q,RS,EI> {
import * as t from 'io-ts';
function request<P extends t.Props>(type:string, props:P) {
return t.type({
type: t.literal(type),
props: t.type(props)
});
}
export const RequestT = t.union([
request('foo', {
baz: t.string,
import {select, put, call, takeEvery} from 'redux-saga/effects';
import {Request} from '../../backend/db/requests-api-types';
import {getType, ActionType} from 'typesafe-actions';
import {actions} from './requests';
import {actions as uiActions} from './ui';
import * as client from '../client/requests';
import {i18nSelector} from './locale';
function* onSuccess(request:Request, _response:Response) {
const i18n = yield select(i18nSelector);
let successText:string | undefined;
import {createStandardAction} from 'typesafe-actions';
import {Request} from '../../backend/db/requests-api-types';
export const request = createStandardAction('REQUESTS_NEW')<Request>();
import * as express from 'express';
import {processRequest} from '../db/admin-api';
import db from '../db/sbas-db';
import {validationFailed} from './errors';
import authRoute from './auth-route';
import {RequestT} from '../db/admin-api-types';
const router = express.Router();
router.post('/admin/:requestType', authRoute(async (auth, req, res, next) => {
try {
const payload = Object.assign({}, req.body, {type: req.params.requestType});