34 lines
807 B
JavaScript
34 lines
807 B
JavaScript
|
import { AUTH_KEY_PENDING, AUTH_KEY_SUCCESS, AUTH_KEY_ERROR } from "../types/AuthKeyType";
|
||
|
import { REHYDRATE } from "redux-persist";
|
||
|
|
||
|
const initialState = {
|
||
|
loading: false,
|
||
|
authKey: null,
|
||
|
error: null,
|
||
|
};
|
||
|
|
||
|
export default (state = initialState, action) => {
|
||
|
switch (action.type) {
|
||
|
case AUTH_KEY_PENDING: return {
|
||
|
...state,
|
||
|
loading: true
|
||
|
}
|
||
|
case AUTH_KEY_SUCCESS: return {
|
||
|
...state,
|
||
|
loading: false,
|
||
|
authKey: action.result.data,
|
||
|
error: null
|
||
|
}
|
||
|
case AUTH_KEY_ERROR: return {
|
||
|
...state,
|
||
|
loading: false,
|
||
|
error: action.result
|
||
|
}
|
||
|
|
||
|
default: {
|
||
|
return state;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
};
|