Skip to content
Snippets Groups Projects
Commit eb52ec9d authored by Josef Olsson's avatar Josef Olsson Committed by Victor Löfgren
Browse files

#31: Change file extensions from .js -> .ts

parent 59dfbaa2
No related branches found
No related tags found
1 merge request!30#31: Change file extensions from .js -> .ts
Pipeline #36939 passed
......@@ -15980,6 +15980,12 @@
"is-typedarray": "^1.0.0"
}
},
"typesafe-actions": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/typesafe-actions/-/typesafe-actions-5.1.0.tgz",
"integrity": "sha512-bna6Yi1pRznoo6Bz1cE6btB/Yy8Xywytyfrzu/wc+NFW3ZF0I+2iCGImhBsoYYCOWuICtRO4yHcnDlzgo1AdNg==",
"dev": true
},
"typescript": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz",
......
......@@ -46,7 +46,8 @@
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"prettier": "^2.2.1"
"prettier": "^2.2.1",
"typesafe-actions": "^5.1.0"
},
"scripts": {
"start": "react-scripts start",
......
import Types from "./types.js";
export function axiosPost(path, data, config = undefined,
startCB = undefined, successCB = undefined, errorCB = undefined){
return {
type: Types.AXIOS_POST,
path,
data,
config,
startCB,
successCB,
errorCB
}
}
export function axiosPostSuccess(path, data, previousAction){
return {
type: Types.AXIOS_POST_SUCCESS,
path,
data,
previousAction
}
}
export function axiosPostError(path, data, previousAction){
return {
type: Types.AXIOS_POST_ERROR,
path,
data,
previousAction
}
}
export function axiosGet(path, data, config = undefined, startCB = undefined, successCB = undefined, errorCB = undefined) {
return {
type: Types.AXIOS_GET,
path,
data,
config,
startCB,
successCB,
errorCB
}
}
export function axiosGetSuccess(path, data, previousAction){
return {
type: Types.AXIOS_GET_SUCCESS,
path,
data,
previousAction
}
}
export function axiosGetError(path, data, previousAction){
return {
type: Types.AXIOS_GET_ERROR,
path,
data,
previousAction
}
}
import Types from './types.js'
export function axiosPost(
path: any,
data: any,
config = undefined,
startCB = undefined,
successCB = undefined,
errorCB = undefined
) {
return {
type: Types.AXIOS_POST,
path,
data,
config,
startCB,
successCB,
errorCB,
}
}
export function axiosPostSuccess(path: any, data: any, previousAction: any) {
return {
type: Types.AXIOS_POST_SUCCESS,
path,
data,
previousAction,
}
}
export function axiosPostError(path: any, data: any, previousAction: any) {
return {
type: Types.AXIOS_POST_ERROR,
path,
data,
previousAction,
}
}
export function axiosGet(
path: any,
data: any,
config = undefined,
startCB = undefined,
successCB = undefined,
errorCB = undefined
) {
return {
type: Types.AXIOS_GET,
path,
data,
config,
startCB,
successCB,
errorCB,
}
}
export function axiosGetSuccess(path: any, data: any, previousAction: any) {
return {
type: Types.AXIOS_GET_SUCCESS,
path,
data,
previousAction,
}
}
export function axiosGetError(path: any, data: any, previousAction: any) {
return {
type: Types.AXIOS_GET_ERROR,
path,
data,
previousAction,
}
}
File moved
File moved
// Combines all the reducers so that we only have to pass "one" reducer to the store in src/index.tsx
import { combineReducers } from 'redux';
import loggedInReducer from './isLoggedIn';
import { combineReducers } from 'redux'
import loggedInReducer from './isLoggedIn'
const allReducers = combineReducers({
// name: state
isLoggedIn: loggedInReducer // You can write "loggedInReducer" because its the same as "loggedInReducer: loggedInReducer"
});
export default allReducers;
\ No newline at end of file
// name: state
isLoggedIn: loggedInReducer, // You can write "loggedInReducer" because its the same as "loggedInReducer: loggedInReducer"
})
export default allReducers
const loggedInReducer = (state = false, action) => { // isLoggedIn has an initial state of false
const loggedInReducer = (state = false, action: { type: any }) => {
// isLoggedIn has an initial state of false
switch (action.type) {
case 'SIGN_IN':
return !state;
return !state
default:
return state;
return state
}
}
export default loggedInReducer
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment