error message

This commit is contained in:
Jesse-Ma
2022-12-05 13:18:12 +08:00
parent 7fb00c8cf5
commit ca5f4ad8a0
10 changed files with 106 additions and 58 deletions

View File

@@ -27,6 +27,10 @@ function getErrorMetaParam() {
}
function getNoteView() {
if(errorMeta){
return;
}
let path = location.pathname;
let key = path.substring(1, path.length);
@@ -49,8 +53,14 @@ function getNoteView() {
//set noteMeta
noteMeta = getNoteMeta(key);
//server error
if (!noteMeta) {
errorMeta = 100006;
return InvalidateNote;
}
//invalidated key
if (!noteMeta || !noteMeta.key) {
if (!noteMeta.key) {
errorMeta = 100002;
return InvalidateNote;
}
@@ -105,6 +115,13 @@ function getHomeRedirect() {
//setKeyMeta
keyMeta = getKeyMeta();
// server error
if (!keyMeta) {
errorMeta = 100006;
return "/invalidatenote";
}
return "/" + keyMeta.key;
}
@@ -114,6 +131,7 @@ const routes = [
name: "home",
redirect: getHomeRedirect(),
},
{ path: "/invalidatenote", component: InvalidateNote },
{
path: "/:name([a-z0-9]{1,20})",
name: "note",