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(){ ...@@ -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) { function readCookie(cname) {
var name = cname + "="; var name = cname + "=";
...@@ -129,12 +149,7 @@ function head(){ ...@@ -129,12 +149,7 @@ function head(){
headlink.innerHTML="Account"; headlink.innerHTML="Account";
headlink.href="/account/"; headlink.href="/account/";
} }
if(typeof user !== 'undefined' && user){ if(profileExists()){ //user has priority
console.log(user)
}else{
console.log("user not defined")
}
if(typeof user !== 'undefined' && user){ //user has priority
headlink.innerHTML="Logout"; headlink.innerHTML="Logout";
headlink.href="/account/logout"; headlink.href="/account/logout";
} }
......
Supports Markdown
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