20 lines
516 B
TypeScript
20 lines
516 B
TypeScript
import { createAsyncThunk } from '@reduxjs/toolkit'
|
|
|
|
import { apiPaths } from '@constants/api/apiPaths.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)
|
|
return response.data
|
|
} catch (error) {
|
|
return rejectWithValue(error)
|
|
}
|
|
}
|
|
)
|