diff options
Diffstat (limited to 'src/store/actions')
| -rw-r--r-- | src/store/actions/index.ts | 1 | ||||
| -rw-r--r-- | src/store/actions/notifications.ts | 21 | ||||
| -rw-r--r-- | src/store/actions/user.ts | 2 | ||||
| -rw-r--r-- | src/store/actions/userX.ts | 2 |
4 files changed, 24 insertions, 2 deletions
diff --git a/src/store/actions/index.ts b/src/store/actions/index.ts index f9fd5e9c..285ca4de 100644 --- a/src/store/actions/index.ts +++ b/src/store/actions/index.ts @@ -6,3 +6,4 @@ export * from './socials'; export * from './taggUsers'; export * from './userBlock'; export * from './userX'; +export * from './notifications'; diff --git a/src/store/actions/notifications.ts b/src/store/actions/notifications.ts new file mode 100644 index 00000000..bace1776 --- /dev/null +++ b/src/store/actions/notifications.ts @@ -0,0 +1,21 @@ +import {Action, ThunkAction} from '@reduxjs/toolkit'; +import {getNotificationsData} from '../../services'; +import {userNotificationsFetched} from '../reducers'; +import {RootState} from '../rootReducer'; + +export const loadUserNotifications = (): ThunkAction< + Promise<void>, + RootState, + unknown, + Action<string> +> => async (dispatch) => { + try { + const notifications = await getNotificationsData(); + dispatch({ + type: userNotificationsFetched.type, + payload: notifications, + }); + } catch (error) { + console.log(error); + } +}; diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index e77b8513..eee5fcde 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -26,7 +26,7 @@ export const loadUserData = ( const token = await getTokenOrLogout(dispatch); const [profile, avatar, cover] = await Promise.all([ loadProfileInfo(token, user.userId), - loadAvatar(token, user.userId), + loadAvatar(user.userId, false), loadCover(token, user.userId), ]); dispatch({ diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts index 87162eb1..e313546e 100644 --- a/src/store/actions/userX.ts +++ b/src/store/actions/userX.ts @@ -52,7 +52,7 @@ export const loadUserX = ( payload: {screenType, userId, data}, }), ); - loadAvatar(token, userId).then((data) => + loadAvatar(userId, false).then((data) => dispatch({ type: userXAvatarFetched.type, payload: {screenType, userId, data}, |
