MSP-3104 add getProfile method

This commit is contained in:
veselovnk committed 2024-04-10 14:39:37 +03:00
1 parent 8cfb1ad921
commit 83f5a04f48
4 files changed
+25 -8

No files matched your search

+5 -2
View File
@@ -2,15 +2,18 @@ import { createAsyncThunk } from '@reduxjs/toolkit'
import { apiPaths } from '@constants/api/apiPaths.ts'
import { ProfileDataType } from '@pages/ProfilePage/profile-page.type.ts'
import { apiService } from '@services/apiService.ts'
import { ProfileDataType } from '@type/profile.type.ts'
export const fetchProfile = createAsyncThunk(
'profile/fetchProfile',
async (_, { rejectWithValue }) => {
try {
const response = await apiService.post<ProfileDataType>(apiPaths.baseUrl)
const response = await apiService.post<ProfileDataType>(
apiPaths.getProfile
)
return response.data
} catch (error) {
return rejectWithValue(error)
+7 -3
View File
@@ -1,13 +1,17 @@
import {
ActionReducerMapBuilder,
PayloadAction,
createSlice
createSlice,
PayloadAction
} from '@reduxjs/toolkit'
import { ProfileDataType, ProfileType } from '@type/profile.type.ts'
import {
ProfileDataType,
ProfileType
} from '@pages/ProfilePage/profile-page.type.ts'
import { fetchProfile } from './ActionCreators.ts'
export enum StateProfileStatus {
resolved = 'resolved',
pending = 'pending',