diff --git a/fe-piattaforma/src/pages/administrator/AdministrativeArea/Entities/modals/manageReport.tsx b/fe-piattaforma/src/pages/administrator/AdministrativeArea/Entities/modals/manageReport.tsx index 35f21f62e..4aa39ee4f 100644 --- a/fe-piattaforma/src/pages/administrator/AdministrativeArea/Entities/modals/manageReport.tsx +++ b/fe-piattaforma/src/pages/administrator/AdministrativeArea/Entities/modals/manageReport.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import { Icon } from 'design-react-kit'; -import React, { useState } from 'react'; +import React, { useCallback, useState } from 'react'; import { useDispatch } from 'react-redux'; import { useParams } from 'react-router-dom'; import GenericModal from '../../../../../components/Modals/GenericModal/genericModal'; @@ -39,15 +39,30 @@ const ManageReport: React.FC = ({ const { id } = useParams(); const userId = useAppSelector(selectUser)?.id; + const saveReportBoardCommunityDocument = useCallback( + async ( + id: string, + userId: string, + entity: 'board' | 'community' | 'document' | 'forum' + ) => { + if (entity === 'forum') { + entity = 'community'; + } + await dispatch(CreateItemReport(id, newReport)); + dispatch(GetItemDetail(id, userId, entity)); + }, + [dispatch, newReport] + ); + const handleSaveReport = async () => { if (newReport.trim() !== '' && payload) { switch (payload.entity) { case 'board': case 'community': case 'document': + case 'forum': if (id && userId) { - await dispatch(CreateItemReport(id, newReport)); - dispatch(GetItemDetail(id, userId, payload.entity)); + await saveReportBoardCommunityDocument(id, userId, payload.entity); } break; case 'comment': diff --git a/fe-piattaforma/src/redux/features/anagraphic/anagraphicThunk.ts b/fe-piattaforma/src/redux/features/anagraphic/anagraphicThunk.ts index c1bbca66e..b1e66846c 100644 --- a/fe-piattaforma/src/redux/features/anagraphic/anagraphicThunk.ts +++ b/fe-piattaforma/src/redux/features/anagraphic/anagraphicThunk.ts @@ -19,7 +19,7 @@ export const GetUsersAnagrapic = } = select((state: RootState) => state); if (idsToGet?.length) { const res = await API.post( - `/utente/listaUtenti?richiediImmagine=${richiediImmagine}`, + `${process?.env?.GESTIONE_UTENTE}utente/listaUtenti?richiediImmagine=${richiediImmagine}`, { idsUtenti: idsToGet, } diff --git a/fe-piattaforma/src/redux/features/forum/forumThunk.ts b/fe-piattaforma/src/redux/features/forum/forumThunk.ts index c85a624f1..16908188c 100644 --- a/fe-piattaforma/src/redux/features/forum/forumThunk.ts +++ b/fe-piattaforma/src/redux/features/forum/forumThunk.ts @@ -223,7 +223,10 @@ export const GetTopicsFilters = ), }; const queryParameters = transformFiltersToQueryParams(body); - const res = await proxyCall(`/community/filters${queryParameters}`, 'GET'); + const res = await proxyCall( + `/community/filters${queryParameters}`, + 'GET' + ); if (res?.data?.data) { dispatch( setForumFilterOptions( @@ -278,7 +281,10 @@ export const GetTopicsList = ...forcedFilters, }).replace('sort', 'sort_by'); //.replace('categories', 'category') - const res = await proxyCall(`/community/items${queryParamFilters}`, 'GET'); + const res = await proxyCall( + `/community/items${queryParamFilters}`, + 'GET' + ); if (updateStore) { if (res?.data?.data) { dispatch(setTopicsList(res.data.data.items || [])); @@ -598,7 +604,8 @@ export const GetItemsByUser = () => async (dispatch: Dispatch) => { dispatch( setTopicsList( (res[1]?.data.data.items || []).filter( - ({ item_type }: { item_type: string }) => item_type === 'community_item' + ({ item_type }: { item_type: string }) => + item_type === 'community_item' ) ) ); @@ -623,12 +630,15 @@ const GetItemDetailsAction = { }; export const GetItemDetail = - (itemId: string, userId: string, entity: 'board' | 'community' | 'document') => + ( + itemId: string, + userId: string, + entity: 'board' | 'community' | 'document' + ) => async (dispatch: Dispatch) => { try { dispatch(showLoader()); dispatch({ ...GetItemDetailsAction }); - const res = await proxyCall( `/${entity}/item/${itemId}/user/${userId}`, 'GET' diff --git a/fe-piattaforma/src/redux/features/user/userSlice.ts b/fe-piattaforma/src/redux/features/user/userSlice.ts index 6b1dcdbc0..20c47edc1 100644 --- a/fe-piattaforma/src/redux/features/user/userSlice.ts +++ b/fe-piattaforma/src/redux/features/user/userSlice.ts @@ -109,9 +109,9 @@ export const userSlice = createSlice({ initialState, reducers: { setUserContext: (state, action: PayloadAction) => { - const {payload} = action; + const { payload } = action; state.user = { - ...payload + ...payload, }; state.ruoli = payload.ruoli; setSessionValues('user', state.user); @@ -151,7 +151,7 @@ export const userSlice = createSlice({ }); }, login: (state) => { - if(state.user){ + if (state.user) { state.user['cfUtenteLoggato'] = state?.user?.codiceFiscale; } setSessionValues('user', state.user); diff --git a/fe-piattaforma/src/redux/features/user/userThunk.ts b/fe-piattaforma/src/redux/features/user/userThunk.ts index fcd75accd..11f21dbcf 100644 --- a/fe-piattaforma/src/redux/features/user/userThunk.ts +++ b/fe-piattaforma/src/redux/features/user/userThunk.ts @@ -324,8 +324,8 @@ export const GetNotificationsByUser = data: { items: [], pager: { - total_items: 1, - total_pages: 1 + total_items: 0, + total_pages: 0 } } }