remove settilte on child class

This commit is contained in:
starnakin 2023-11-30 13:05:46 +01:00
parent 65a027014b
commit 5d8005df44
15 changed files with 23 additions and 30 deletions

View File

@ -7,6 +7,6 @@ from rest_framework.authentication import SessionAuthentication
class DeleteView(APIView):
permission_classes = (permissions.IsAuthenticated,)
authentication_classes = (SessionAuthentication,)
def post(self, request: HttpRequest):
def delete(self, request: HttpRequest):
request.user.delete()
return Response("user deleted", status=status.HTTP_200_OK)

View File

@ -75,6 +75,7 @@ const router = async (uri = "") => {
if (content == null)
return 1;
view.setTitle();
document.querySelector("#app").innerHTML = content
await view.postInit();

View File

@ -2,8 +2,8 @@ import { client, navigateTo } from "../index.js";
import AbstractRedirectView from "./AbstractRedirectView.js";
export default class extends AbstractRedirectView{
constructor(params) {
super(params, "/login");
constructor(params, title) {
super(params, title, "/login");
}
async redirect()

View File

@ -2,8 +2,8 @@ import { client, navigateTo } from "../index.js";
import AbstractRedirectView from "./AbstractRedirectView.js";
export default class extends AbstractRedirectView{
constructor(params, url) {
super(params, url);
constructor(params, title, url) {
super(params, title, url);
}
async redirect()

View File

@ -2,9 +2,9 @@ import { navigateTo } from "../index.js";
import AbstractView from "./AbstractView.js";
export default class extends AbstractView{
constructor(params, url)
constructor(params, title, url)
{
super(params);
super(params, title);
this.redirect_url = url;
}

View File

@ -1,6 +1,7 @@
export default class {
constructor(params) {
constructor(params, title) {
this.params = params;
this.title = title;
}
async postInit() {
@ -9,8 +10,8 @@ export default class {
async leavePage() {
}
setTitle(title) {
document.title = title;
setTitle() {
document.title = this.title;
}
async getHtml() {

View File

@ -1,9 +1,8 @@
import AbstractView from "./AbstractView.js";
import AbstractAuthentifiedView from "./AbstractAuthentifiedView.js";
export default class extends AbstractView {
export default class extends AbstractAuthentifiedView {
constructor(params) {
super(params);
this.setTitle("Chat");
super(params, "Chat");
let url = `wss://${window.location.host}/ws/socket-server/`

View File

@ -2,8 +2,7 @@ import AbstractView from "./AbstractView.js";
export default class extends AbstractView {
constructor(params) {
super(params);
this.setTitle("Dashboard");
super(params, "Dashboard");
}
async getHtml() {

View File

@ -2,8 +2,7 @@ import AbstractAuthentificateView from "./AbstractAuthentifiedView.js";
export default class extends AbstractAuthentificateView {
constructor(params) {
super(params);
this.setTitle("Home");
super(params, "Home");
this.redirect_url = "/login"
}

View File

@ -2,9 +2,8 @@ import AbstractView from "./AbstractView.js";
export default class extends AbstractView {
constructor(params) {
super(params);
super(params, "Viewing Post");
this.postId = params.id;
this.setTitle("Viewing Post");
}
async getHtml() {

View File

@ -2,8 +2,7 @@ import AbstractView from "./AbstractView.js";
export default class extends AbstractView {
constructor(params) {
super(params);
this.setTitle("Posts");
super(params, "Posts");
}
async getHtml() {

View File

@ -2,8 +2,7 @@ import AbstractView from "./AbstractView.js";
export default class extends AbstractView {
constructor(params) {
super(params);
this.setTitle("Settings");
super(params, "Settings");
}
async getHtml() {

View File

@ -29,12 +29,11 @@ async function login()
export default class extends AbstractNonAuthentifiedView {
constructor(params) {
super(params, "/home");
super(params, "Login", "/home");
}
async postInit()
{
this.setTitle("Login");
document.getElementById("button").onclick = login;
}

View File

@ -4,8 +4,7 @@ import AbstractAuthentifiedView from "../AbstractAuthentifiedView.js";
export default class extends AbstractAuthentifiedView
{
constructor(params) {
super(params);
this.setTitle("Logout");
super(params, "Logout");
client.logout();
navigateTo("/login")
}

View File

@ -24,12 +24,11 @@ async function register()
export default class extends AbstractAuthentifiedView {
constructor(params) {
super(params, "/home");
super(params, "Register", "/home");
}
async postInit()
{
this.setTitle("register");
document.getElementById("button").onclick = register;
}