mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
Add log in / log off to messages page
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { getMyAccount, unhideElementById } from './generalUseHelpers.js';
|
||||||
// messages.ts
|
// messages.ts
|
||||||
|
|
||||||
async function getMyMessages() {
|
async function getMyMessages() {
|
||||||
@@ -88,6 +89,15 @@ async function loadMessages() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
try {
|
||||||
|
var user = await getMyAccount();
|
||||||
|
if (user) {
|
||||||
|
unhideElementById(document, "logout-btn");
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
unhideElementById(document, "joinnow-btn");
|
||||||
|
unhideElementById(document, "signin-btn");
|
||||||
|
}
|
||||||
loadMessages();
|
loadMessages();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
"use strict";
|
|
||||||
// messages.ts
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -9,6 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
import { getMyAccount, unhideElementById } from './generalUseHelpers.js';
|
||||||
|
// messages.ts
|
||||||
function getMyMessages() {
|
function getMyMessages() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const res = yield fetch('/api/messages/my', {
|
const res = yield fetch('/api/messages/my', {
|
||||||
@@ -92,6 +92,16 @@ function loadMessages() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
|
var user = yield getMyAccount();
|
||||||
|
if (user) {
|
||||||
|
unhideElementById(document, "logout-btn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
unhideElementById(document, "joinnow-btn");
|
||||||
|
unhideElementById(document, "signin-btn");
|
||||||
|
}
|
||||||
loadMessages();
|
loadMessages();
|
||||||
});
|
}));
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="module" src="/js/messages.js"></script>
|
<script type="module" src="/js/messages.js"></script>
|
||||||
|
<script type="module" src="js/auth.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user