Remove unused status
This commit is contained in:
parent
51f66aa6cd
commit
df60338352
1 changed files with 2 additions and 9 deletions
|
@ -247,7 +247,6 @@ function UserProvider(props) {
|
||||||
const { user } = useAuthState();
|
const { user } = useAuthState();
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
status: 'idle',
|
|
||||||
user: null,
|
user: null,
|
||||||
error: null,
|
error: null,
|
||||||
pathname: '',
|
pathname: '',
|
||||||
|
@ -257,13 +256,9 @@ function UserProvider(props) {
|
||||||
setState({ user, pathname });
|
setState({ user, pathname });
|
||||||
}, [user, pathname]);
|
}, [user, pathname]);
|
||||||
|
|
||||||
const fetchClassrooms = () => {
|
const fetchClassrooms = () => getClassrooms(user.id);
|
||||||
return getClassrooms(user.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchAssignments = () => {
|
const fetchAssignments = () => getAssignments(user.id);
|
||||||
return getAssignments(user.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UserContext.Provider
|
<UserContext.Provider
|
||||||
|
@ -275,11 +270,9 @@ function UserProvider(props) {
|
||||||
|
|
||||||
function useUser() {
|
function useUser() {
|
||||||
const { state, fetchClassrooms, fetchAssignments } = useContext(UserContext);
|
const { state, fetchClassrooms, fetchAssignments } = useContext(UserContext);
|
||||||
const isPending = state.status === 'pending';
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
state,
|
state,
|
||||||
isPending,
|
|
||||||
fetchClassrooms,
|
fetchClassrooms,
|
||||||
fetchAssignments,
|
fetchAssignments,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue