|
@@ -601,7 +601,7 @@ actionFullRegister = (login,password) => async dispatch => {
|
|
|
}
|
|
|
|
|
|
let pLog = document.createElement('p')
|
|
|
- pLog.innerHTML = "Ваш логин:" + " " + store.getState().auth.payload.sub.login
|
|
|
+
|
|
|
pLog.style.float = 'right'
|
|
|
pLog.style.fontWeight = 'bold'
|
|
|
pLog.style.marginTop = '20px'
|
|
@@ -611,6 +611,7 @@ if (localStorage.authToken) {
|
|
|
regBtn.hidden = true
|
|
|
logBtn.hidden = true
|
|
|
header.append(unlogBtn)
|
|
|
+ pLog.innerHTML = "Ваш логин:" + " " + store.getState().auth.payload.sub.login
|
|
|
header.append(pLog)
|
|
|
}
|
|
|
|
|
@@ -755,6 +756,11 @@ actionOrder = (obj) => async dispatch => {
|
|
|
btnBuy.style.marginRight = '500px'
|
|
|
btnBuy.style.marginTop = '10px'
|
|
|
btnBuy.onclick = () => {
|
|
|
+ if (!localStorage.authToken){
|
|
|
+ alert('Для начала авторизуйтесь')
|
|
|
+ location.href = '#/login'
|
|
|
+ }
|
|
|
+ else {
|
|
|
let obj = store.getState().cart
|
|
|
for (key in obj){
|
|
|
store.dispatch(actionOrder(obj))
|
|
@@ -762,6 +768,7 @@ actionOrder = (obj) => async dispatch => {
|
|
|
store.dispatch({type: 'CART_CLEAR'})
|
|
|
countBasket.innerHTML ="Товаров в корзине:" + " " + 0
|
|
|
}
|
|
|
+ }
|
|
|
main.append(orderPrice)
|
|
|
main.append(btnBuy)
|
|
|
|