Skip to content

Commit

Permalink
Merge pull request #221 from Lapkipomoshi/dev-payment
Browse files Browse the repository at this point in the history
added token
  • Loading branch information
Notsmartname committed May 8, 2024
2 parents 1eb0c41 + e4d6577 commit 2cd234f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/modules/AboutShelter/AboutShelter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import setPayment from './api';

const AboutShelter = () => {
const { shelter, isOwner, isLoading } = useOutletContext();

console.log(shelter);
if (isLoading) {
return null;
}
Expand All @@ -24,7 +24,8 @@ const AboutShelter = () => {
// TODO сделать попап при удалении приюта (6.2.1.3 в фигме)

const handleSetPayment = () => {
setPayment();
// let token = localStorage.getItem('access');
setPayment(localStorage.getItem('access'));
};

return (
Expand Down
16 changes: 9 additions & 7 deletions src/modules/AboutShelter/api.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { apiHeaders, baseUrl } from '../../utils/constants';
import { baseUrl } from '../../utils/constants';

const setPayment = async () => {
const setPayment = async (token) => {
// Перенаправить на страницу OAuth-сервера ЮKassa
const response = await fetch(`${baseUrl}/v1/payments/get-partner-link/`, {
method: 'GET',
headers: apiHeaders,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`,
},
redirect: 'follow'
}).then(
console.log('OK')
);
// Перенаправить на страницу OAuth-сервера ЮKassa
// .then((res) => {
// console.log(res);
// });

if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
Expand Down
1 change: 0 additions & 1 deletion src/modules/ShelterOwnerProfile/ShelterOwnerProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ProfileSheltersBlock from '../../components/ProfileSheltersBlock/ProfileS
const ShelterOwnerProfile = () => {
const currentUser = useContext(CurrentUserContext);
const myShelters = [currentUser.own_shelter];

return (
<div>
<ProfileSheltersBlock
Expand Down

0 comments on commit 2cd234f

Please sign in to comment.