userinfo ausgeben
This commit is contained in:
parent
0ba4a11d23
commit
4421f6b307
@ -1,6 +1,8 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
userinfo();
|
||||||
|
|
||||||
$(document).on("click", ".btn_detail", function() {
|
$(document).on("click", ".btn_detail", function() {
|
||||||
window.location.replace("/shoppinglist_json/" + $(this).closest("tr").attr("id"));
|
window.location.replace("/shoppinglist_json/" + $(this).closest("tr").attr("id"));
|
||||||
});
|
});
|
||||||
@ -29,6 +31,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
|
|
||||||
@ -57,4 +60,15 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function userinfo() {
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "/userinfo_json",
|
||||||
|
success(data) {
|
||||||
|
$(".userinfo").empty();
|
||||||
|
$(".userinfo").append("Logged in as: " + data.profile.displayName);
|
||||||
|
$(".user_img").attr("src", data.profile.photos[0].value);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
}
|
@ -134,4 +134,8 @@ router.get("/test1", (req, res) => {
|
|||||||
res.render("index1");
|
res.render("index1");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get("/userinfo_json", (req, res) => {
|
||||||
|
res.send(req.session.passport.user);
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p>Logged in as: testuser1</p>
|
<p class="userinfo">Logged in as: testuser1</p>
|
||||||
|
<img class="user_img">
|
||||||
<br>
|
<br>
|
||||||
<div class="col s6">
|
<div class="col s6">
|
||||||
<a href="/logout" class="waves-effect waves-light btn">Logout</a>
|
<a href="/logout" class="waves-effect waves-light btn">Logout</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user