[frontend] Added props field for chat page size

This commit is contained in:
Rohan Sircar 2020-05-30 11:09:39 +05:30
parent 28dca30bca
commit 95edebc834
4 changed files with 7 additions and 2 deletions

View File

@ -148,7 +148,7 @@ export class ChatModelHelper {
return;
}
headers.append("X-AUTH-TOKEN", JsonAPI.authToken);
const url = Sprintf(JsonAPI.CHAT_MESSAGE_PAGE_GET, toUser, page, 5);
const url = Sprintf(JsonAPI.CHAT_MESSAGE_PAGE_GET, toUser, page, JsonAPI.CHAT_PAGE_SIZE);
log.debug(url);
const response = await fetch(url, {
method: "GET",

View File

@ -2,6 +2,7 @@ export namespace JsonAPI {
export let principleName: string = localStorage.getItem("username") || "";
export let contactName: string = "";
export let authToken: string = localStorage.getItem("authToken") || "";
export const CHAT_PAGE_SIZE: number = parseInt(localStorage.getItem("CHAT_PAGE_SIZE") || "9") || 9;
export const ACTIVE_USERS_GET = `/api/chat/get/active-users`;
/**
* Json API URL for retrieving all messages between two users

View File

@ -23,4 +23,5 @@ logging.level.org.springframework.cache=DEBUG
chatto.token.timeout-duration=30
chat-bundle=bundle.js
# spring.devtools.add-properties=false
chatto.frontend.log-level=TRACE
chatto.frontend.log-level=TRACE
chatto.frontend.chat-page-size=9

View File

@ -63,6 +63,9 @@
<script th:inline="javascript" defer>
let loglevel = /*[[${@environment.getProperty('chatto.frontend.log-level')}]]*/ "DEBUG";
window.log.setLevel(loglevel)
let chatPageSize = /*[[${@environment.getProperty('chatto.frontend.chat-page-size')}]]*/ 9;
localStorage.setItem("CHAT_PAGE_SIZE", chatPageSize);
</script>
<meta charset="UTF-8">