Skip to content

Commit

Permalink
refactor: Rename action CLEAR_STATE -> RESET
Browse files Browse the repository at this point in the history
  • Loading branch information
atomdmac committed Sep 23, 2020
1 parent 8aee75a commit 9aa8195
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/upload-reducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const SET_ERROR = 'SET_ERROR';
export const START_UPLOADING = 'START_UPLOADING';
export const SET_UPLOAD_PROGRESS = 'SET_UPLOAD_PROGRESS';
export const FINISH_UPLOADING = 'FINISH_UPLOADING';
export const CLEAR_STATE = 'CLEAR_STATE';
export const RESET = 'RESET';

export type UploadState = {
loading: boolean;
Expand All @@ -25,7 +25,7 @@ export type Action =
| { type: 'SET_UPLOAD_PROGRESS'; payload: number }
| { type: 'SET_ERROR'; payload: string }
| { type: 'FINISH_UPLOADING'; payload: any }
| { type: 'CLEAR_STATE'; };
| { type: 'RESET'; };

export type dispatchType = (action: Action) => void;

Expand All @@ -46,7 +46,7 @@ export function reducer(state: UploadState, action: Action): UploadState {
response: action.payload,
error: action.payload.error ? action.payload.response : false,
};
case CLEAR_STATE:
case RESET:
return {
...initialState
};
Expand Down
4 changes: 2 additions & 2 deletions src/use-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
FINISH_UPLOADING,
dispatchType,
initialState,
CLEAR_STATE,
RESET,
} from './upload-reducer';
import { XHRClient, XHROptions, createXhrClient } from './clients/xhr';
import { FileOrFileList } from './';
Expand Down Expand Up @@ -65,6 +65,6 @@ export const useUpload = (

return {
...state,
reset: () => dispatch({ type: CLEAR_STATE })
reset: () => dispatch({ type: RESET })
};
};

0 comments on commit 9aa8195

Please sign in to comment.