Skip to content

Commit

Permalink
Clean up the index file - thanks @osban
Browse files Browse the repository at this point in the history
  • Loading branch information
josephspurrier committed Jul 28, 2020
1 parent 49c09f2 commit 5609a4f
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions src/app/ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ m.route.prefix = "";
m.route(document.body, "/", {
"/": {
onmatch: () => {
if (CookieStore.isLoggedIn()) return Index;
else m.route.set("/login");
if (!CookieStore.isLoggedIn()) m.route.set("/login");
},
render: () => m(LayoutMain, m(HomePage)),
},
"/notepad": {
onmatch: () => {
if (CookieStore.isLoggedIn()) return Notepad;
else m.route.set("/login");
if (!CookieStore.isLoggedIn()) m.route.set("/login");
},
render: () => m(LayoutMain, m(NotepadPage)),
},
"/login": {
onmatch: () => {
if (CookieStore.isLoggedIn()) m.route.set("/");
else return Login;
},
render: () => m(LayoutMain, m(LoginPage)),
},
"/register": {
onmatch: () => {
if (CookieStore.isLoggedIn()) m.route.set("/");
else return Register;
},
render: () => m(LayoutMain, m(RegisterPage)),
},
"/about": {
render: () => {
Expand All @@ -48,27 +48,3 @@ m.route(document.body, "/", {
},
},
});

var Index = {
view: () => {
return m(LayoutMain, m(HomePage));
},
};

var Notepad = {
view: () => {
return m(LayoutMain, m(NotepadPage));
},
};

var Login = {
view: () => {
return m(LayoutMain, m(LoginPage));
},
};

var Register = {
view: () => {
return m(LayoutMain, m(RegisterPage));
},
};

0 comments on commit 5609a4f

Please sign in to comment.