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): class DeleteView(APIView):
permission_classes = (permissions.IsAuthenticated,) permission_classes = (permissions.IsAuthenticated,)
authentication_classes = (SessionAuthentication,) authentication_classes = (SessionAuthentication,)
def post(self, request: HttpRequest): def delete(self, request: HttpRequest):
request.user.delete() request.user.delete()
return Response("user deleted", status=status.HTTP_200_OK) return Response("user deleted", status=status.HTTP_200_OK)

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
export default class { export default class {
constructor(params) { constructor(params, title) {
this.params = params; this.params = params;
this.title = title;
} }
async postInit() { async postInit() {
@ -9,8 +10,8 @@ export default class {
async leavePage() { async leavePage() {
} }
setTitle(title) { setTitle() {
document.title = title; document.title = this.title;
} }
async getHtml() { 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) { constructor(params) {
super(params); super(params, "Chat");
this.setTitle("Chat");
let url = `wss://${window.location.host}/ws/socket-server/` 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 { export default class extends AbstractView {
constructor(params) { constructor(params) {
super(params); super(params, "Dashboard");
this.setTitle("Dashboard");
} }
async getHtml() { async getHtml() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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