Browse Source

always route to post 1 if bare url is present

pull/1/head
wes 8 years ago
parent
commit
7fdb1f0f77
  1. 9
      src/scripts/post.tag

9
src/scripts/post.tag

@ -63,7 +63,7 @@ prev(ev) {
} }
if (self.pid > 1) { if (self.pid > 1) {
self.pid--; self.pid--;
route(`/${self.pid}`); route(`/post/${self.pid}`);
self.update(); self.update();
} }
} }
@ -76,12 +76,13 @@ next(ev) {
self.nextloading = " loading"; self.nextloading = " loading";
if (!self.nomore) { if (!self.nomore) {
self.pid++; self.pid++;
route(`/${self.pid}`); route(`/post/${self.pid}`);
self.update(); self.update();
} }
} }
setPost(pid) { setPost(pid) {
console.log(pid);
this.pid = pid; this.pid = pid;
this.update(); this.update();
this.loading = true; this.loading = true;
@ -91,7 +92,6 @@ setPost(pid) {
(body) => { (body) => {
if (body === "false") { if (body === "false") {
self.nomore = true; self.nomore = true;
route("/");
self.update() self.update()
} }
else { else {
@ -121,7 +121,8 @@ setPost(pid) {
}); });
} }
this.on("mount", () => { this.on("mount", () => {
route("*", this.setPost); route("/", () => { route("/post/1") });
route("/post/*", this.setPost);
console.log("starting the router"); console.log("starting the router");
route.start(true); route.start(true);
}); });

Loading…
Cancel
Save