All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ducks.user.selectors.ts Maven / Gradle / Ivy

The newest version!
import { createSelector } from '@reduxjs/toolkit'
import omit from 'lodash/omit'

import { EMPTY_OBJECT } from '../../utils/emptyTypes'
import { State } from '../State'

export const authSelector = (state: State) => state.user || EMPTY_OBJECT

export const isLoggedInSelector = createSelector(
    authSelector,
    user => user.isLoggedIn,
)

export const userSelector = createSelector(
    authSelector,
    user => omit(user, ['isLoggedIn']),
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy