execute error page hooks

This commit is contained in:
cudr
2019-04-06 02:32:11 +03:00
parent 7be7e1eb9f
commit 3a9d457389
6 changed files with 80 additions and 21 deletions

View File

@@ -6,6 +6,7 @@ import {
scroll_history,
scroll_state,
select_target,
handle_error,
set_target,
uid,
set_uid,
@@ -34,10 +35,12 @@ export default function start(opts: {
history.replaceState({ id: uid }, '', href);
if (!initial_data.error) {
const target = select_target(new URL(location.href));
if (target) return navigate(target, uid, false, hash);
}
const url = new URL(location.href)
if (initial_data.error) return handle_error(url);
const target = select_target(url);
if (target) return navigate(target, uid, false, hash);
});
}
@@ -127,4 +130,4 @@ function handle_popstate(event: PopStateEvent) {
set_cid(uid);
history.replaceState({ id: cid }, '', location.href);
}
}
}