MSP-3104 add getProfile method
This commit is contained in:
1 parent
8cfb1ad921
commit
83f5a04f48
4 files changed
+25
-8
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user