Skip to content

Commit

Permalink
Merge pull request #219 from Lapkipomoshi/dev-payment
Browse files Browse the repository at this point in the history
Dev payment
  • Loading branch information
Notsmartname committed May 8, 2024
2 parents eefb1e7 + 15ffd35 commit 1eb0c41
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/modules/AboutShelter/AboutShelter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import EditIcon from '../../images/EditIcon/EditIcon';
import DeleteIcon from '../../images/DeleteIcon/DeleteIcon';
import ShelterOwnerStatistics from '../ShelterOwnerStatistics/ShelterOwnerStatistics';
import petLogo from '../../images/pet.jpg';
import setPayment from './api';

// TODO переделать названия классов (объединить?), не совсем понятно, по какому принципу about-shelter, shelter-info

Expand All @@ -22,6 +23,10 @@ const AboutShelter = () => {
// TODO подключить рероутер на редактирование инфо о приюте (6.2.1.4 в фигме)
// TODO сделать попап при удалении приюта (6.2.1.3 в фигме)

const handleSetPayment = () => {
setPayment();
};

return (
<section className='shelter-section shelter-section__about'>
<div className='shelter-section__top'>
Expand Down Expand Up @@ -100,7 +105,9 @@ const AboutShelter = () => {
<h3 className='standard-font_type_h3 standard-font'>
Подключить платежную систему
</h3>
<Button>Подключить платеж</Button>
<Button
onClick={handleSetPayment}
>Подключить платеж</Button>
</div>
)}
</section>
Expand Down
20 changes: 20 additions & 0 deletions src/modules/AboutShelter/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { apiHeaders, baseUrl } from '../../utils/constants';

const setPayment = async () => {
const response = await fetch(`${baseUrl}/v1/payments/get-partner-link/`, {
method: 'GET',
headers: apiHeaders,
redirect: 'follow'
}).then(
console.log('OK')
);
// Перенаправить на страницу OAuth-сервера ЮKassa
// .then((res) => {
// console.log(res);
// });
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}

};
export default setPayment;

0 comments on commit 1eb0c41

Please sign in to comment.