-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transform; global app context, navigation, app reducer, to use typesc…
…ript, switch from JSX.Element to ReactElement,
- Loading branch information
1 parent
33efc82
commit a04b08e
Showing
17 changed files
with
86 additions
and
204 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
src/components/shared/footer.jsx → src/components/shared/footer.tsx
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import AppStoreType from '../types/store/app-store-type'; | ||
|
||
const SET_HEROES = (state: any, { heroData } : any) => ({ | ||
...state, | ||
heroData, | ||
}); | ||
|
||
const SET_LOADING = (state: any, { isLoading, loadingID }: any) => ({ | ||
...state, | ||
isLoading, | ||
loadingID, | ||
}); | ||
|
||
const SET_ERROR = (state: any, { error }: any) => ({ | ||
...state, | ||
error, | ||
}); | ||
|
||
export const appInitialState : AppStoreType = { | ||
heroData: [], | ||
authToken: '', | ||
error: null, | ||
isLoading: false, | ||
loadingID: '', | ||
userAuthenticated: false, | ||
}; | ||
|
||
export const appReducer = (state: any, action: { type: (arg0: any, arg1: any) => any; }) => { | ||
if (typeof action.type === 'function') { | ||
return action.type(state, action); | ||
} | ||
|
||
return state; | ||
}; | ||
|
||
export default { | ||
SET_HEROES, | ||
SET_LOADING, | ||
SET_ERROR, | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { ReactElement } from "react"; | ||
|
||
interface AppContextProps { | ||
children: ReactElement | ||
} | ||
|
||
export default AppContextProps; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
interface AppStoreType { | ||
heroData: object | null, | ||
authToken: string | null, | ||
error: object | null, | ||
isLoading: boolean, | ||
loadingID: string, | ||
userAuthenticated: boolean, | ||
} | ||
|
||
export default AppStoreType; |