24 lines
688 B
JavaScript
24 lines
688 B
JavaScript
import axios from 'axios'
|
|
import CONFIG from '@/core/config.js'
|
|
|
|
const createProfile = async (profile) => {
|
|
try {
|
|
const token = localStorage.getItem('access_token') // или другой способ получения токена
|
|
const response = await axios.post(
|
|
`${CONFIG.BASE_URL}/profiles/`,
|
|
profile,
|
|
{
|
|
withCredentials: true,
|
|
headers: {
|
|
Authorization: `Bearer ${token}`
|
|
}
|
|
}
|
|
)
|
|
return response.data
|
|
} catch (error) {
|
|
throw new Error(error.response?.data?.detail || error.message)
|
|
}
|
|
}
|
|
|
|
export default createProfile
|