if (typeof req.headers.token !== "undefined") {
const token = req.headers.token.split(' ')[1]
this.jwt.verify(token, this.secretKey, {
algorithms: 'HS256'
}
getDataServis.users()
.then((res,rej)=>{
vm.arr = res.data
})
Значения промиса получается с помощью нотации await в рамках асинхронной функции,)
function getData($http) {
this.users = async function(){
const connect = await $http.get('http://localhost:3000/getUsers')
return connect
}
}
Promise {<pending>}
__proto__: Promise
[[PromiseStatus]]: "resolved"
[[PromiseValue]]: Object
var validHash = function(){
console.log(hashtagsArr())
var noHash = false;
if (inputHashtags.value != "") {
for(i=0; i<hashtagsArr().length; i++){
if(hashtagsArr()[i].charAt(0) != '#'){
noHash = true;
} else {
noHash = false;
}
}
if (noHash) {
console.log('Ошибка');
inputHashtags.setCustomValidity('ошибка')
}else {
uploadForm.submit();
}
}else {
uploadForm.submit();
}
}