Skip to content

Instantly share code, notes, and snippets.

@trybick
trybick / searchShows.ts
Created May 10, 2020 23:43
Cached request creator with axios and cancel tokens
import axios, { CancelTokenSource } from 'axios';
import { ShowSearchResult } from 'types/external';
import { MOVIE_DB_URL } from 'utils/constants';
//
// Our app calls searchShows
// It uses a request creator for results caching and cancel tokens
//
interface SearchShowData {
@trybick
trybick / actions.ts
Last active May 10, 2020 23:42
Redux stack using Typescript, Thunk, and Redux Persist
import axios from 'axios';
import { AppThunk } from 'store';
import { baseUrl } from 'utils/constants';
import handleErrors from 'utils/handleErrors';
export const FETCH_USER_FOLLOWS = 'FETCH_USER_FOLLOWS';
export const REMOVE_FROM_FOLLOWED_SHOWS = 'REMOVE_FROM_FOLLOWED_SHOWS';
export const SAVE_TO_FOLLOWED_SHOWS = 'SAVE_TO_FOLLOWED_SHOWS';
export const SET_HAS_LOCAL_WARNING_TOAST_BEEN_SHOWN = 'SET_HAS_LOCAL_WARNING_TOAST_BEEN_SHOWN';
export const SET_IS_LOGGED_IN_FALSE = 'SET_IS_LOGGED_IN_FALSE';