change user membership without payment
This commit is contained in:
@@ -18,8 +18,24 @@ const PricingCard: React.FC<PricingCardProps> = ({
|
||||
const handlePlanChange = async () => {
|
||||
try {
|
||||
setIsLoading(true)
|
||||
console.log('Changing plan to:', plan)
|
||||
// const response = await changePlan(plan) -- тут обработка данных запроса на смену плана
|
||||
|
||||
const requestData = {
|
||||
plan: plan,
|
||||
}
|
||||
|
||||
const response = await fetch('/api/account/membership', {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(requestData),
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await response.json()
|
||||
console.error('PricingCard - Server error:', error)
|
||||
throw new Error(error.error || 'Ошибка при создании маршрута')
|
||||
}
|
||||
|
||||
// обновляем данные в сторе
|
||||
if (user) {
|
||||
|
||||
Reference in New Issue
Block a user