diff --git a/frontend/static/js/index.js b/frontend/static/js/index.js index 47255df..d5bef31 100644 --- a/frontend/static/js/index.js +++ b/frontend/static/js/index.js @@ -3,6 +3,7 @@ import Dashboard from "./views/Dashboard.js"; import Posts from "./views/Posts.js"; import PostView from "./views/PostView.js"; import Settings from "./views/Settings.js"; +import Search from "./views/Search.js"; import Chat from "./views/Chat.js"; import HomeView from "./views/HomeView.js"; import RegisterView from "./views/accounts/RegisterView.js"; @@ -40,6 +41,7 @@ const router = async (uri = "") => { { path: "/login", view: LoginView }, { path: "/logout", view: LogoutView }, { path: "/register", view: RegisterView }, + { path: "/search", view: Search }, { path: "/chat", view: Chat }, { path: "/home", view: HomeView }, ]; @@ -94,4 +96,4 @@ document.addEventListener("DOMContentLoaded", () => { router(location.pathname); }); -export { client, navigateTo } \ No newline at end of file +export { client, navigateTo } diff --git a/frontend/static/js/views/Chat.js b/frontend/static/js/views/Chat.js index de4b02b..472be28 100644 --- a/frontend/static/js/views/Chat.js +++ b/frontend/static/js/views/Chat.js @@ -4,7 +4,7 @@ export default class extends AbstractAuthentifiedView { constructor(params) { super(params, "Chat"); - let url = `wss://${window.location.host}/ws/socket-server/` + let url = `ws://${window.location.host}/ws/socket-server/` this.chatSocket = new WebSocket(url) this.chatSocket.onmessage = function(e){ @@ -44,7 +44,7 @@ export default class extends AbstractAuthentifiedView {

Chat

- +
diff --git a/frontend/static/js/views/Search.js b/frontend/static/js/views/Search.js new file mode 100644 index 0000000..9a8bb52 --- /dev/null +++ b/frontend/static/js/views/Search.js @@ -0,0 +1,38 @@ +import AbstractAuthentifiedView from "./AbstractAuthentifiedView.js"; + +export default class extends AbstractAuthentifiedView { + constructor(params) { + super(params, "Search"); + } + + async postInit() { + let users = ["cramptéMan", "cacaMan", "chatteWomen"] + + let list_users = document.getElementById('list_users'); + for (const user of users) { + var new_user = document.createElement("li"); + new_user.appendChild(document.createTextNode(user)); + list_users.appendChild(new_user); + } + console.log(list_users); + } + + async leavePage() { + } + + async getHtml() { + return ` +

Search

+ +
+ +
+ +
+ +
+ + `; + } +} diff --git a/frontend/static/js/views/accounts/RegisterView.js b/frontend/static/js/views/accounts/RegisterView.js index 5873b4c..f6c23ec 100644 --- a/frontend/static/js/views/accounts/RegisterView.js +++ b/frontend/static/js/views/accounts/RegisterView.js @@ -47,4 +47,4 @@ export default class extends AbstractAuthentifiedView {
`; } -} \ No newline at end of file +} diff --git a/frontend/templates/index.html b/frontend/templates/index.html index 36e1ff5..e6b8e37 100644 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -14,7 +14,7 @@ Settings Login Register - Chat + Search