Commit 1f23ea54 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

user profile fetch

parent 909224be
Pipeline #366 passed with stage
in 5 seconds
......@@ -23,6 +23,26 @@ function userAuthenticated(){
}
}
var user = false;
function profileExists(){
$.get( "/api/v1/profile", function(data) {
let email = data.email
if(email != ''){
user = true;
}
})
.done(function() {
console.log("done fetching profile info");
})
.fail(function() {
console.log( "error fetching profile info" );
})
return user;
}
function readCookie(cname) {
var name = cname + "=";
......@@ -129,12 +149,7 @@ function head(){
headlink.innerHTML="Account";
headlink.href="/account/";
}
if(typeof user !== 'undefined' && user){
console.log(user)
}else{
console.log("user not defined")
}
if(typeof user !== 'undefined' && user){ //user has priority
if(profileExists()){ //user has priority
headlink.innerHTML="Logout";
headlink.href="/account/logout";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment