This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let i = 0; i < array.length; i++) { | |
const el = array[i]; | |
// do something here | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const setStatus = (status, message) => SET_STATUS({ status, message }); | |
const getResponseJson = async response => response.json(); | |
const fetchUrl = url => () => fetch(url); | |
function updateState(dispatch) { | |
const dispatchStatus = status => () => dispatch(setStatus(status)); | |
const dispatchError = ({ message }) => dispatch(setStatus('error', message)); | |
const dispatchState = data => dispatch(SET_STATE({ data })); | |
return Promise.resolve() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const setStatus = (status, message) => SET_STATUS({ status, message }); | |
const getResponseJson = async response => response.json(); | |
const fetchUrl = url => () => fetch(url); | |
function updateState(dispatch) { | |
const dispatchStatus = status => () => dispatch(setStatus(status)); | |
const dispatchError = ({ message }) => dispatch(setStatus('error', message)); | |
const dispatchState = data => dispatch(SET_STATE({ data })); | |
dispatchStatus('submitting')(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getResponseJson = async response => response.json(); | |
function updateState(dispatch) { | |
const dispatchStatus = status => dispatch(SET_STATUS({ status })); | |
const dispatchError = e => | |
dispatch(SET_STATUS({ status: 'error', message: e.message })); | |
const dispatchState = data => dispatch(SET_STATE({ data })); | |
dispatchStatus('submitting'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getResponseJson = async response => response.json(); | |
function updateState(dispatch) { | |
const dispatchStatus = status => dispatch(SET_STATUS({ status })); | |
const dispatchError = e => | |
dispatch(SET_STATUS({ status: 'error', message: e.message })); | |
const dispatchState = data => dispatch(SET_STATE({ data })); | |
dispatchStatus('submitting'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateState(dispatch) { | |
const dispatchStatus = status => dispatch(SET_STATUS({ status })); | |
const dispatchError = e => | |
dispatch(SET_STATUS({ status: 'error', message: e.message })); | |
dispatchStatus('submitting'); | |
return fetch('https://example.com/api/a') | |
.then(() => { | |
dispatchStatus('processing'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateState(dispatch) { | |
// helper functions | |
const dispatchError = e => | |
dispatch(SET_STATUS({ status: 'error', message: e.message })); | |
dispatch(SET_STATUS({ status: 'submitting' })); | |
return fetch('https://example.com/api/a') | |
.then(() => { | |
dispatch(SET_STATUS({ status: 'processing' })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateState(dispatch) { | |
dispatch(SET_STATUS({ status: 'submitting' })); | |
return fetch('https://example.com/api/a') | |
.then(() => { | |
dispatch(SET_STATUS({ status: 'processing' })); | |
return fetch('https://example.com/api/b') | |
.then(response => { | |
return response | |
.json() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('The Initialization Form', () => { | |
beforeEach(() => { | |
cy.fixture('config.json').as('config') | |
indexedDB.deleteDatabase('localforage') | |
cy.server() | |
cy.route({ | |
method: 'POST', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="map" :style="`height: ${height}px;`"> | |
<svg ref="svg" class="map-container" | |
xmlns="http://www.w3.org/2000/svg" | |
:width="width" :height="height" | |
shape-rendering="geometricPrecision" | |
:viewBox="`500 100 200 400`" | |
> | |
</svg> | |
</div> |