Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
const handlers: Object = {
SYNC_IS_CONNECTED: (
state: AppState,
{ isConnected }: { isConnected: boolean },
) => ({
isConnected,
}),
};
// Selectors
export const isConnectedSelector = (state: State) => state.appstate.isConnected;
const globalNetworkDown = new NetworkDown();
// $FlowFixMe
export const networkErrorSelector = createSelector(
isConnectedSelector,
isConnected => (!isConnected ? globalNetworkDown : null),
);
export default handleActions(handlers, initialState);
const remapError = error => {
const msg = error.message;
if (
msg.includes("Unable to resolve host") ||
msg.includes("Network is down")
) {
return new NetworkDown();
}
return error;
};
async () => {
const { data } = await network({
method: "GET",
url: URL.format({
pathname: `${getEnv("MANAGER_API_BASE")}/applications`,
query: { livecommonversion }
})
});
if (!data || !Array.isArray(data)) {
throw new NetworkDown("");
}
return data;
},
() => ""
const remapError = error => {
const msg = error.message
if (msg.includes('Unable to resolve host') || msg.includes('Network is down')) {
return new NetworkDown()
}
return error
}