Don't merge, it's prototypal
This commit is contained in:
parent
c2b6dbb989
commit
af9595c447
@ -3,6 +3,7 @@ import Dashboard from "./views/Dashboard.js";
|
|||||||
import Posts from "./views/Posts.js";
|
import Posts from "./views/Posts.js";
|
||||||
import PostView from "./views/PostView.js";
|
import PostView from "./views/PostView.js";
|
||||||
import Settings from "./views/Settings.js";
|
import Settings from "./views/Settings.js";
|
||||||
|
import Search from "./views/Search.js";
|
||||||
import Chat from "./views/Chat.js";
|
import Chat from "./views/Chat.js";
|
||||||
import HomeView from "./views/HomeView.js";
|
import HomeView from "./views/HomeView.js";
|
||||||
import RegisterView from "./views/accounts/RegisterView.js";
|
import RegisterView from "./views/accounts/RegisterView.js";
|
||||||
@ -40,6 +41,7 @@ const router = async (uri = "") => {
|
|||||||
{ path: "/login", view: LoginView },
|
{ path: "/login", view: LoginView },
|
||||||
{ path: "/logout", view: LogoutView },
|
{ path: "/logout", view: LogoutView },
|
||||||
{ path: "/register", view: RegisterView },
|
{ path: "/register", view: RegisterView },
|
||||||
|
{ path: "/search", view: Search },
|
||||||
{ path: "/chat", view: Chat },
|
{ path: "/chat", view: Chat },
|
||||||
{ path: "/home", view: HomeView },
|
{ path: "/home", view: HomeView },
|
||||||
];
|
];
|
||||||
@ -94,4 +96,4 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
router(location.pathname);
|
router(location.pathname);
|
||||||
});
|
});
|
||||||
|
|
||||||
export { client, navigateTo }
|
export { client, navigateTo }
|
||||||
|
@ -4,7 +4,7 @@ export default class extends AbstractAuthentifiedView {
|
|||||||
constructor(params) {
|
constructor(params) {
|
||||||
super(params, "Chat");
|
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 = new WebSocket(url)
|
||||||
this.chatSocket.onmessage = function(e){
|
this.chatSocket.onmessage = function(e){
|
||||||
@ -44,7 +44,7 @@ export default class extends AbstractAuthentifiedView {
|
|||||||
<h1>Chat</h1>
|
<h1>Chat</h1>
|
||||||
|
|
||||||
<form id="form">
|
<form id="form">
|
||||||
<input type="text" name="message" />
|
<input type="text" name="message" placeholder="message"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div id="messages">
|
<div id="messages">
|
||||||
|
38
frontend/static/js/views/Search.js
Normal file
38
frontend/static/js/views/Search.js
Normal file
@ -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 `
|
||||||
|
<h1>Search</h1>
|
||||||
|
|
||||||
|
<form id="form">
|
||||||
|
<input type="text" name="message" placeholder="user name to crampte"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div id="users">
|
||||||
|
<ul id="list_users">
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
@ -47,4 +47,4 @@ export default class extends AbstractAuthentifiedView {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<a href="/settings" class="nav__link" data-link>Settings</a>
|
<a href="/settings" class="nav__link" data-link>Settings</a>
|
||||||
<a href="/login" class="nav__link" data-link>Login</a>
|
<a href="/login" class="nav__link" data-link>Login</a>
|
||||||
<a href="/register" class="nav__link" data-link>Register</a>
|
<a href="/register" class="nav__link" data-link>Register</a>
|
||||||
<a href="/chat" class="nav__link" data-link>Chat</a>
|
<a href="/search" class="nav__link" data-link>Search</a>
|
||||||
</nav>
|
</nav>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="{% static 'js/index.js' %}"></script>
|
<script type="module" src="{% static 'js/index.js' %}"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user