mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
removed boris reducer
This commit is contained in:
parent
77af1ab05a
commit
120bf8954c
72 changed files with 225 additions and 298 deletions
|
@ -2,13 +2,12 @@ import { useDispatch } from 'react-redux';
|
|||
import { useCallback, useEffect } from 'react';
|
||||
import isBefore from 'date-fns/isBefore';
|
||||
import { authSetState, authSetUser } from '~/redux/auth/actions';
|
||||
import { borisLoadStats } from '~/redux/boris/actions';
|
||||
import { useUser } from '~/hooks/user/userUser';
|
||||
import { IComment } from '~/redux/types';
|
||||
import { useShallowSelect } from '~/hooks/data/useShallowSelect';
|
||||
import { selectAuthIsTester } from '~/redux/auth/selectors';
|
||||
import { selectBorisStats } from '~/redux/boris/selectors';
|
||||
import { useRandomPhrase } from '~/constants/phrases';
|
||||
import { useBorisStats } from '~/hooks/boris/useBorisStats';
|
||||
|
||||
export const useBoris = (comments: IComment[]) => {
|
||||
const dispatch = useDispatch();
|
||||
|
@ -29,9 +28,7 @@ export const useBoris = (comments: IComment[]) => {
|
|||
dispatch(authSetUser({ last_seen_boris: last_comment.created_at }));
|
||||
}, [user.last_seen_boris, dispatch, comments]);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(borisLoadStats());
|
||||
}, [dispatch]);
|
||||
const { stats, isLoading: isLoadingStats } = useBorisStats();
|
||||
|
||||
const setIsBetaTester = useCallback(
|
||||
(is_tester: boolean) => {
|
||||
|
@ -41,8 +38,7 @@ export const useBoris = (comments: IComment[]) => {
|
|||
);
|
||||
|
||||
const isTester = useShallowSelect(selectAuthIsTester);
|
||||
const stats = useShallowSelect(selectBorisStats);
|
||||
const title = useRandomPhrase('BORIS_TITLE');
|
||||
|
||||
return { setIsBetaTester, isTester, stats, title };
|
||||
return { setIsBetaTester, isTester, stats, title, isLoadingStats };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue