|
@@ -364,8 +364,20 @@ const actionPromise = (name, promise) =>
|
|
header.append(aLogBtn)
|
|
header.append(aLogBtn)
|
|
aRegBtn.append(regBtn)
|
|
aRegBtn.append(regBtn)
|
|
header.append(aRegBtn)
|
|
header.append(aRegBtn)
|
|
- let aCabinet = document.createElement('a')
|
|
|
|
- aCabinet.href = '#/cabinet'
|
|
|
|
|
|
+ // let aCabinet = document.createElement('a')
|
|
|
|
+ // aCabinet.href = '#/cabinet'
|
|
|
|
+ let unlogBtn = document.createElement('button')
|
|
|
|
+ unlogBtn.style.marginTop = '20px'
|
|
|
|
+ unlogBtn.style.float = 'right'
|
|
|
|
+ unlogBtn.innerHTML = "Выйти"
|
|
|
|
+ unlogBtn.style.marginLeft = '10px'
|
|
|
|
+ unlogBtn.onclick = () => {
|
|
|
|
+ let question = confirm ('Вы уверены что хотите выйти?')
|
|
|
|
+ if (question) {
|
|
|
|
+ store.dispatch(actionAuthLogout())
|
|
|
|
+ location.reload()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
function drawReg() {
|
|
function drawReg() {
|
|
main.innerHTML = ""
|
|
main.innerHTML = ""
|
|
@@ -567,13 +579,7 @@ const actionFullLogin = (login , password) => async dispatch => {
|
|
let result = await dispatch(actionPromise("login",log(login,password)))
|
|
let result = await dispatch(actionPromise("login",log(login,password)))
|
|
if (result.data.login !== null){
|
|
if (result.data.login !== null){
|
|
dispatch(actionAuthLogin(result.data.login))
|
|
dispatch(actionAuthLogin(result.data.login))
|
|
- logBtn.hidden = true
|
|
|
|
- regBtn.hidden = true
|
|
|
|
- main.innerHTML = ''
|
|
|
|
- let hLog = document.createElement('h1')
|
|
|
|
- hLog.innerHTML = "Вы успешно войшли в свой кабинет"
|
|
|
|
- hLog.style.textAlign = 'center'
|
|
|
|
- main.append(hLog)
|
|
|
|
|
|
+ location.reload()
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
alert ('Такого пользователя не существует или вы не правильно указали логин/пароль')
|
|
alert ('Такого пользователя не существует или вы не правильно указали логин/пароль')
|
|
@@ -586,14 +592,7 @@ actionFullRegister = (login,password) => async dispatch => {
|
|
console.log(result)
|
|
console.log(result)
|
|
if (result.errors === undefined) {
|
|
if (result.errors === undefined) {
|
|
await dispatch (actionFullLogin(login,password))
|
|
await dispatch (actionFullLogin(login,password))
|
|
- logBtn.hidden = true
|
|
|
|
- regBtn.hidden = true
|
|
|
|
- main.innerHTML = ""
|
|
|
|
- let hReg = document.createElement('h1')
|
|
|
|
- hReg.innerHTML = "Вы успешно зарегестрированы"
|
|
|
|
- hReg.style.textAlign = 'center'
|
|
|
|
- main.append(hReg)
|
|
|
|
-
|
|
|
|
|
|
+ location.reload()
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
alert("Такой пользователь уже есть")
|
|
alert("Такой пользователь уже есть")
|
|
@@ -601,9 +600,18 @@ 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'
|
|
|
|
+ pLog.style.color = '#000080'
|
|
|
|
+
|
|
if (localStorage.authToken) {
|
|
if (localStorage.authToken) {
|
|
regBtn.hidden = true
|
|
regBtn.hidden = true
|
|
logBtn.hidden = true
|
|
logBtn.hidden = true
|
|
|
|
+ header.append(unlogBtn)
|
|
|
|
+ header.append(pLog)
|
|
}
|
|
}
|
|
|
|
|
|
let newOrder = async(obj) => {
|
|
let newOrder = async(obj) => {
|