2018-06-04 00:06:17 +08:00
|
|
|
(function (global, document) {
|
|
|
|
|
|
|
|
// Get self details.
|
|
|
|
global.selfGet = function(callback) {
|
|
|
|
var json = {
|
2018-06-20 11:36:49 +08:00
|
|
|
"ownerToken": global.cookieGet("commentoOwnerToken"),
|
2018-06-04 00:06:17 +08:00
|
|
|
};
|
|
|
|
|
2018-08-08 14:00:59 +08:00
|
|
|
if (json.ownerToken === undefined) {
|
|
|
|
document.location = "/login";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-16 21:25:27 +08:00
|
|
|
global.post(global.commentoOrigin + "/api/owner/self", json, function(resp) {
|
2018-06-04 00:06:17 +08:00
|
|
|
if (!resp.success || !resp.loggedIn) {
|
2018-08-08 14:00:59 +08:00
|
|
|
global.cookieDelete("commentoOwnerToken");
|
2018-06-04 00:06:17 +08:00
|
|
|
document.location = "/login";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
global.owner = resp.owner;
|
|
|
|
callback();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
}(window, document));
|