Skip to content

Instantly share code, notes, and snippets.

@AllGistsEqual
Created February 22, 2021 20:03
Show Gist options
  • Save AllGistsEqual/b22ba7439218fcd57e8d56a168ef7a4a to your computer and use it in GitHub Desktop.
Save AllGistsEqual/b22ba7439218fcd57e8d56a168ef7a4a to your computer and use it in GitHub Desktop.
// File: src/redux/ducks/article.ts
/* eslint-disable no-param-reassign */
import { Middleware } from 'redux'
import { createAction, createReducer } from '@reduxjs/toolkit'
import { apiRequest } from './api'
export type Article = {
title: string
author: string
date: number
tags: string[]
excerpt: string
urls: {
page: string
url: string
}[]
}
export type RequestStatus = 'idle' | 'pending'
type InitialState = {
data: Article[] | null
status: RequestStatus
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment