19 lines
357 B
JavaScript
19 lines
357 B
JavaScript
|
import React from "react";
|
||
|
|
||
|
export default function loginReducer(prevState, action) {
|
||
|
switch (action.type) {
|
||
|
case "SIGN_IN":
|
||
|
return {
|
||
|
...prevState,
|
||
|
isSignin: true,
|
||
|
userToken: action.token,
|
||
|
};
|
||
|
case "SIGN_OUT":
|
||
|
return {
|
||
|
...prevState,
|
||
|
isSignin: false,
|
||
|
userToken: null,
|
||
|
};
|
||
|
}
|
||
|
}
|