el
Size: a a a
el
DP
C
IL

MK
C
IL
a
D4
export const onLogin = (credentials) => async (dispatch) => {
const rawResponse = await fetch(
"https://stranger-go.com/api/v1/token/login/",
{
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify(
credentials
),
}
);
if (rawResponse.ok) {
const content = await rawResponse.json();
const response = await fetch("https://stranger-go.com/api/v1/users/me/", {
method: "GET",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
Authorization: `Token ${content.auth_token}`,
},
});
if (response.ok) {
const userData = await response.json();
dispatch({
type: SET_TOKEN,
payload: content.auth_token,
});
dispatch({
type: SET_AUTH,
payload: true,
});
dispatch({
type: SET_ADMIN,
payload: userData.is_staff,
});
dispatch({
type: SET_BLOCK,
payload: userData.is_block,
});
} else {
const err = await response.json();
alert("Ошибка HTTP: " + response.status + " " + JSON.stringify(err));
}
} else {
const err = await rawResponse.json();
alert("Ошибка HTTP: " + rawResponse.status + " " + JSON.stringify(err));
}
};IL
C
D
C
E
PK

const SliderButtonStyled = styled.button`
position: absolute;
top: 50%;
left: 10%;
border: none;
transition: all ease 0.2s;
padding: 0;
width: 36px;
height: 36px;
border-radius: 50%;
opacity: 0.8;
z-index: 6
// some code
\
C
\
C
\