Refactor router

This commit is contained in:
Chocobozzz 2019-02-22 14:55:47 +01:00 committed by Thomas Citharel
parent d73f738b1b
commit 53cb39350a
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
19 changed files with 316 additions and 288 deletions

142
js/package-lock.json generated
View File

@ -1833,7 +1833,7 @@
"dependencies": { "dependencies": {
"semver": { "semver": {
"version": "5.0.3", "version": "5.0.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", "resolved": "http://registry.npmjs.org/semver/-/semver-5.0.3.tgz",
"integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=", "integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=",
"dev": true "dev": true
} }
@ -2150,7 +2150,7 @@
}, },
"array-equal": { "array-equal": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", "resolved": "http://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
"integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=",
"dev": true "dev": true
}, },
@ -2282,7 +2282,7 @@
}, },
"async": { "async": {
"version": "1.5.2", "version": "1.5.2",
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=",
"dev": true "dev": true
}, },
@ -2367,7 +2367,7 @@
}, },
"chalk": { "chalk": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -2386,7 +2386,7 @@
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -3038,7 +3038,7 @@
}, },
"camelcase-keys": { "camelcase-keys": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
"integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -3164,11 +3164,6 @@
"is-regex": "^1.0.3" "is-regex": "^1.0.3"
} }
}, },
"charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
},
"check-error": { "check-error": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
@ -3196,7 +3191,7 @@
"dependencies": { "dependencies": {
"css-select": { "css-select": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
"integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=",
"requires": { "requires": {
"boolbase": "~1.0.0", "boolbase": "~1.0.0",
@ -3427,7 +3422,7 @@
}, },
"get-stream": { "get-stream": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
"dev": true "dev": true
} }
@ -4010,11 +4005,6 @@
"which": "^1.2.9" "which": "^1.2.9"
} }
}, },
"crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
},
"crypto-browserify": { "crypto-browserify": {
"version": "3.12.0", "version": "3.12.0",
"resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz",
@ -4042,7 +4032,7 @@
}, },
"css-color-names": { "css-color-names": {
"version": "0.0.4", "version": "0.0.4",
"resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", "resolved": "http://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
"integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=", "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=",
"dev": true "dev": true
}, },
@ -4149,7 +4139,7 @@
}, },
"jsesc": { "jsesc": {
"version": "0.5.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true "dev": true
}, },
@ -4166,13 +4156,13 @@
}, },
"regjsgen": { "regjsgen": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz",
"integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=",
"dev": true "dev": true
}, },
"regjsparser": { "regjsparser": {
"version": "0.1.5", "version": "0.1.5",
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz",
"integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -4412,7 +4402,7 @@
}, },
"deep-eql": { "deep-eql": {
"version": "0.1.3", "version": "0.1.3",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", "resolved": "http://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz",
"integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -4470,7 +4460,7 @@
}, },
"get-stream": { "get-stream": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
"dev": true "dev": true
} }
@ -4774,7 +4764,7 @@
}, },
"duplexer": { "duplexer": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
"integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
"dev": true "dev": true
}, },
@ -5497,7 +5487,7 @@
}, },
"finalhandler": { "finalhandler": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -6277,7 +6267,7 @@
}, },
"readable-stream": { "readable-stream": {
"version": "1.1.14", "version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -6344,7 +6334,7 @@
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -6495,7 +6485,7 @@
}, },
"globby": { "globby": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
"integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -6508,7 +6498,7 @@
"dependencies": { "dependencies": {
"pify": { "pify": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true "dev": true
} }
@ -6843,7 +6833,7 @@
}, },
"html-webpack-plugin": { "html-webpack-plugin": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz", "resolved": "http://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz",
"integrity": "sha1-sBq71yOsqqeze2r0SS69oD2d03s=", "integrity": "sha1-sBq71yOsqqeze2r0SS69oD2d03s=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -6872,7 +6862,7 @@
}, },
"htmlparser2": { "htmlparser2": {
"version": "3.3.0", "version": "3.3.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.3.0.tgz", "resolved": "http://registry.npmjs.org/htmlparser2/-/htmlparser2-3.3.0.tgz",
"integrity": "sha1-zHDQWln2VC5D8OaFyYLhTJJKnv4=", "integrity": "sha1-zHDQWln2VC5D8OaFyYLhTJJKnv4=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -6899,7 +6889,7 @@
}, },
"readable-stream": { "readable-stream": {
"version": "1.0.34", "version": "1.0.34",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -6925,7 +6915,7 @@
}, },
"http-errors": { "http-errors": {
"version": "1.6.3", "version": "1.6.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -6982,7 +6972,7 @@
}, },
"http-proxy-middleware": { "http-proxy-middleware": {
"version": "0.18.0", "version": "0.18.0",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz", "resolved": "http://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz",
"integrity": "sha512-Fs25KVMPAIIcgjMZkVHJoKg9VcXcC1C8yb9JUgeDvVXY0S/zgVIhMb+qVswDIgtJe2DfckMSY2d6TuTEutlk6Q==", "integrity": "sha512-Fs25KVMPAIIcgjMZkVHJoKg9VcXcC1C8yb9JUgeDvVXY0S/zgVIhMb+qVswDIgtJe2DfckMSY2d6TuTEutlk6Q==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -8443,16 +8433,6 @@
"resolved": "https://registry.npmjs.org/material-design-icons/-/material-design-icons-3.0.1.tgz", "resolved": "https://registry.npmjs.org/material-design-icons/-/material-design-icons-3.0.1.tgz",
"integrity": "sha1-mnHEh0chjrylHlGmbaaCA4zct78=" "integrity": "sha1-mnHEh0chjrylHlGmbaaCA4zct78="
}, },
"md5": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz",
"integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=",
"requires": {
"charenc": "~0.0.1",
"crypt": "~0.0.1",
"is-buffer": "~1.1.1"
}
},
"md5.js": { "md5.js": {
"version": "1.3.5", "version": "1.3.5",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
@ -8477,7 +8457,7 @@
}, },
"media-typer": { "media-typer": {
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
"dev": true "dev": true
}, },
@ -8504,7 +8484,7 @@
}, },
"meow": { "meow": {
"version": "3.7.0", "version": "3.7.0",
"resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
"integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -8729,7 +8709,7 @@
}, },
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -8777,7 +8757,7 @@
}, },
"commander": { "commander": {
"version": "2.15.1", "version": "2.15.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
"dev": true "dev": true
}, },
@ -8863,7 +8843,7 @@
}, },
"debug": { "debug": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", "resolved": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -8892,7 +8872,7 @@
}, },
"ms": { "ms": {
"version": "0.7.1", "version": "0.7.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", "resolved": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=",
"dev": true "dev": true
}, },
@ -9284,7 +9264,7 @@
"dependencies": { "dependencies": {
"semver": { "semver": {
"version": "5.3.0", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
"integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=",
"dev": true "dev": true
} }
@ -9390,7 +9370,7 @@
}, },
"chalk": { "chalk": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -9413,7 +9393,7 @@
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -9755,7 +9735,7 @@
}, },
"os-homedir": { "os-homedir": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"dev": true "dev": true
}, },
@ -9772,7 +9752,7 @@
}, },
"os-tmpdir": { "os-tmpdir": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
"dev": true "dev": true
}, },
@ -10074,7 +10054,7 @@
}, },
"path-is-absolute": { "path-is-absolute": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true "dev": true
}, },
@ -10794,7 +10774,7 @@
}, },
"pretty-bytes": { "pretty-bytes": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", "resolved": "http://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
"integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=", "integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=",
"dev": true "dev": true
}, },
@ -10883,7 +10863,7 @@
}, },
"lru-cache": { "lru-cache": {
"version": "2.6.5", "version": "2.6.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz", "resolved": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz",
"integrity": "sha1-5W1jVBSO3o13B7WNFDIg/QjfD9U=", "integrity": "sha1-5W1jVBSO3o13B7WNFDIg/QjfD9U=",
"dev": true "dev": true
}, },
@ -11017,7 +10997,7 @@
}, },
"yargs": { "yargs": {
"version": "3.10.0", "version": "3.10.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",
"integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=",
"requires": { "requires": {
"camelcase": "^1.0.2", "camelcase": "^1.0.2",
@ -11254,7 +11234,7 @@
}, },
"pify": { "pify": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true "dev": true
}, },
@ -11429,7 +11409,7 @@
"dependencies": { "dependencies": {
"jsesc": { "jsesc": {
"version": "0.5.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true "dev": true
} }
@ -11468,7 +11448,7 @@
}, },
"css-select": { "css-select": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
"integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -11490,7 +11470,7 @@
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -11705,7 +11685,7 @@
}, },
"safe-regex": { "safe-regex": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -11779,7 +11759,7 @@
}, },
"os-locale": { "os-locale": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -11799,7 +11779,7 @@
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -11901,7 +11881,7 @@
"dependencies": { "dependencies": {
"source-map": { "source-map": {
"version": "0.4.4", "version": "0.4.4",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
"integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -12702,7 +12682,7 @@
}, },
"strip-eof": { "strip-eof": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
"dev": true "dev": true
}, },
@ -12805,7 +12785,7 @@
}, },
"tar": { "tar": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz",
"integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -13762,14 +13742,6 @@
"resolved": "https://registry.npmjs.org/vue-gettext/-/vue-gettext-2.1.2.tgz", "resolved": "https://registry.npmjs.org/vue-gettext/-/vue-gettext-2.1.2.tgz",
"integrity": "sha512-issGZfHvGntflaoLd+46Ru305lWOVEG/0vTI7uB5zvq/4JVGoF7J/+DUrcYswowiCKpJluYqf6inILat2HNeRQ==" "integrity": "sha512-issGZfHvGntflaoLd+46Ru305lWOVEG/0vTI7uB5zvq/4JVGoF7J/+DUrcYswowiCKpJluYqf6inILat2HNeRQ=="
}, },
"vue-gravatar": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/vue-gravatar/-/vue-gravatar-1.3.0.tgz",
"integrity": "sha512-g22+v1bSR9HbDEkAeKznHowYHvdgfVzz8sd3w1zDH+C4g+d6xnwaj3Td7NzMwRxWYVkNaSrts/hpW+RjCLxe9Q==",
"requires": {
"md5": "^2.2.1"
}
},
"vue-hot-reload-api": { "vue-hot-reload-api": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.1.tgz", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.1.tgz",
@ -14095,7 +14067,7 @@
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -14278,7 +14250,7 @@
"dependencies": { "dependencies": {
"acorn": { "acorn": {
"version": "3.3.0", "version": "3.3.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", "resolved": "http://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
"integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=" "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo="
}, },
"acorn-globals": { "acorn-globals": {
@ -14354,7 +14326,7 @@
"dependencies": { "dependencies": {
"hoek": { "hoek": {
"version": "4.2.1", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", "resolved": "http://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==",
"dev": true "dev": true
}, },
@ -14371,7 +14343,7 @@
}, },
"topo": { "topo": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz", "resolved": "http://registry.npmjs.org/topo/-/topo-2.0.2.tgz",
"integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=", "integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -14498,7 +14470,7 @@
}, },
"wrap-ansi": { "wrap-ansi": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -14534,7 +14506,7 @@
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -14689,7 +14661,7 @@
}, },
"get-stream": { "get-stream": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
"dev": true "dev": true
}, },

View File

@ -30,7 +30,6 @@
"vue-apollo": "^3.0.0-beta.28", "vue-apollo": "^3.0.0-beta.28",
"vue-class-component": "^6.3.2", "vue-class-component": "^6.3.2",
"vue-gettext": "^2.1.2", "vue-gettext": "^2.1.2",
"vue-gravatar": "^1.3.0",
"vue-markdown": "^2.2.4", "vue-markdown": "^2.2.4",
"vue-property-decorator": "^7.3.0", "vue-property-decorator": "^7.3.0",
"vue-router": "^3.0.2", "vue-router": "^3.0.2",

View File

@ -50,7 +50,8 @@ import { CURRENT_USER_CLIENT } from "@/graphql/user";
import { onLogout } from "@/vue-apollo"; import { onLogout } from "@/vue-apollo";
import { deleteUserData } from "@/utils/auth"; import { deleteUserData } from "@/utils/auth";
import { LOGGED_PERSON } from "@/graphql/actor"; import { LOGGED_PERSON } from "@/graphql/actor";
import { IPerson } from "../types/actor.model"; import { IActor, IPerson } from '../types/actor.model';
import { RouteName } from '@/router'
@Component({ @Component({
apollo: { apollo: {
@ -100,25 +101,26 @@ export default class NavBar extends Vue {
}); });
} }
@Watch("model") @Watch('model')
onModelChanged(val) { onModelChanged(val) {
switch (val.__typename) { switch (val.__typename) {
case "Event": case 'Event':
this.$router.push({ name: "Event", params: { uuid: val.uuid } }); this.$router.push({ name: RouteName.EVENT, params: { uuid: val.uuid } });
break; break;
case "Actor":
case 'Actor':
this.$router.push({ this.$router.push({
name: "Profile", name: RouteName.PROFILE,
params: { name: this.username_with_domain(val) } params: { name: this.usernameWithDomain(val) },
}); });
break; break;
} }
} }
username_with_domain(actor) { usernameWithDomain(actor: IActor) {
return ( return (
actor.preferredUsername + actor.preferredUsername +
(actor.domain === null ? "" : `@${actor.domain}`) (actor.domain === null ? '' : `@${actor.domain}`)
); );
} }
@ -128,7 +130,7 @@ export default class NavBar extends Vue {
} }
logout() { logout() {
alert("logout !"); alert('logout !');
deleteUserData(); deleteUserData();

48
js/src/router/actor.ts Normal file
View File

@ -0,0 +1,48 @@
import Profile from '@/views/Account/Profile.vue';
import CreateGroup from '@/views/Group/Create.vue';
import Group from '@/views/Group/Group.vue';
import GroupList from '@/views/Group/GroupList.vue';
import Identities from '@/views/Account/Identities.vue';
export enum ActorRouteName {
IDENTITIES = 'Identities',
GROUP_LIST = 'GroupList',
GROUP = 'Group',
CREATE_GROUP = 'CreateGroup',
PROFILE = 'Profile',
}
export const actorRoutes = [
{
path: '/identities',
name: ActorRouteName.IDENTITIES,
component: Identities,
meta: { requiredAuth: true },
},
{
path: '/groups',
name: ActorRouteName.GROUP_LIST,
component: GroupList,
meta: { requiredAuth: false },
},
{
path: '/groups/create',
name: ActorRouteName.CREATE_GROUP,
component: CreateGroup,
meta: { requiredAuth: true },
},
{
path: '/~:name',
name: ActorRouteName.GROUP,
component: Group,
props: true,
meta: { requiredAuth: false },
},
{
path: '/@:name',
name: ActorRouteName.PROFILE,
component: Profile,
props: true,
meta: { requiredAuth: false },
},
];

22
js/src/router/category.ts Normal file
View File

@ -0,0 +1,22 @@
import CategoryList from '@/views/Category/List.vue';
import CreateCategory from '@/views/Category/Create.vue';
export enum CategoryRouteName {
CATEGORY_LIST = 'CategoryList',
CREATE_CATEGORY = 'CreateCategory',
}
export const categoryRoutes = [
{
path: '/category',
name: CategoryRouteName.CATEGORY_LIST,
component: CategoryList,
meta: { requiredAuth: false },
},
{
path: '/category/create',
name: CategoryRouteName.CREATE_CATEGORY,
component: CreateCategory,
meta: { requiredAuth: true },
},
];

47
js/src/router/event.ts Normal file
View File

@ -0,0 +1,47 @@
import EventList from '@/views/Event/EventList.vue';
import Location from '@/views/Location.vue';
import CreateEvent from '@/views/Event/Create.vue';
import Event from '@/views/Event/Event.vue';
export enum EventRouteName {
EVENT_LIST = 'EventList',
CREATE_EVENT = 'CreateEvent',
EDIT_EVENT = 'EditEvent',
EVENT = 'Event',
LOCATION = 'Location',
}
export const eventRoutes = [
{
path: '/events/list/:location?',
name: EventRouteName.EVENT_LIST,
component: EventList,
meta: { requiredAuth: false },
},
{
path: '/events/create',
name: EventRouteName.CREATE_EVENT,
component: CreateEvent,
meta: { requiredAuth: true },
},
{
path: '/events/:id/edit',
name: EventRouteName.EDIT_EVENT,
component: CreateEvent,
props: true,
meta: { requiredAuth: true },
},
{
path: '/location/new',
name: EventRouteName.LOCATION,
component: Location,
meta: { requiredAuth: true },
},
{
path: '/events/:uuid',
name: EventRouteName.EVENT,
component: Event,
props: true,
meta: { requiredAuth: false },
},
];

View File

@ -2,111 +2,47 @@ import Vue from 'vue';
import Router from 'vue-router'; import Router from 'vue-router';
import PageNotFound from '@/views/PageNotFound.vue'; import PageNotFound from '@/views/PageNotFound.vue';
import Home from '@/views/Home.vue'; import Home from '@/views/Home.vue';
import Event from '@/views/Event/Event.vue'; import { UserRouteName, userRoutes } from './user';
import EventList from '@/views/Event/EventList.vue'; import { EventRouteName, eventRoutes } from '@/router/event';
import Location from '@/views/Location.vue'; import { ActorRouteName, actorRoutes } from '@/router/actor';
import CreateEvent from '@/views/Event/Create.vue'; import { CategoryRouteName, categoryRoutes } from '@/router/category';
import CategoryList from '@/views/Category/List.vue';
import CreateCategory from '@/views/Category/Create.vue';
import Profile from '@/views/Account/Profile.vue';
import CreateGroup from '@/views/Group/Create.vue';
import Group from '@/views/Group/Group.vue';
import GroupList from '@/views/Group/GroupList.vue';
import Identities from '@/views/Account/Identities.vue';
import userRoutes from './user';
Vue.use(Router); Vue.use(Router);
enum GlobalRouteName {
HOME = 'Home',
PAGE_NOT_FOUND = 'PageNotFound',
}
// Hack to merge enums
// tslint:disable:variable-name
export const RouteName = {
...GlobalRouteName,
...UserRouteName,
...EventRouteName,
...CategoryRouteName,
...ActorRouteName,
};
const router = new Router({ const router = new Router({
mode: 'history', mode: 'history',
base: '/', base: '/',
routes: [ routes: [
...userRoutes, ...userRoutes,
...eventRoutes,
...categoryRoutes,
...actorRoutes,
{ {
path: '/', path: '/',
name: 'Home', name: RouteName.HOME,
component: Home, component: Home,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },
{
path: '/events/list/:location?',
name: 'EventList',
component: EventList,
meta: { requiredAuth: false },
},
{
path: '/events/create',
name: 'CreateEvent',
component: CreateEvent,
meta: { requiredAuth: true },
},
{
path: '/events/:id/edit',
name: 'EditEvent',
component: CreateEvent,
props: true,
meta: { requiredAuth: true },
},
{
path: '/location/new',
name: 'Location',
component: Location,
meta: { requiredAuth: true },
},
{
path: '/category',
name: 'CategoryList',
component: CategoryList,
meta: { requiredAuth: false },
},
{
path: '/category/create',
name: 'CreateCategory',
component: CreateCategory,
meta: { requiredAuth: true },
},
{
path: '/identities',
name: 'Identities',
component: Identities,
meta: { requiredAuth: true },
},
{
path: '/groups',
name: 'GroupList',
component: GroupList,
meta: { requiredAuth: false },
},
{
path: '/groups/create',
name: 'CreateGroup',
component: CreateGroup,
meta: { requiredAuth: true },
},
{
path: '/~:name',
name: 'Group',
component: Group,
props: true,
meta: { requiredAuth: false },
},
{
path: '/@:name',
name: 'Profile',
component: Profile,
props: true,
meta: { requiredAuth: false },
},
{
path: '/events/:uuid',
name: 'Event',
component: Event,
props: true,
meta: { requiredAuth: false },
},
{ {
path: '*', path: '*',
name: 'PageNotFound', name: RouteName.PAGE_NOT_FOUND,
component: PageNotFound, component: PageNotFound,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },

View File

@ -6,53 +6,63 @@ import ResendConfirmation from '@/views/User/ResendConfirmation.vue';
import SendPasswordReset from '@/views/User/SendPasswordReset.vue'; import SendPasswordReset from '@/views/User/SendPasswordReset.vue';
import PasswordReset from '@/views/User/PasswordReset.vue'; import PasswordReset from '@/views/User/PasswordReset.vue';
export default [ export enum UserRouteName {
REGISTER = 'Register',
REGISTER_PROFILE = 'RegisterProfile',
RESEND_CONFIRMATION = 'ResendConfirmation',
SEND_PASSWORD_RESET = 'SendPasswordReset',
PASSWORD_RESET = 'PasswordReset',
VALIDATE = 'Validate',
LOGIN = 'Login',
}
export const userRoutes = [
{ {
path: '/register/user', path: '/register/user',
name: 'Register', name: UserRouteName.REGISTER,
component: RegisterUser, component: RegisterUser,
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },
{ {
path: '/register/profile', path: '/register/profile',
name: 'RegisterProfile', name: UserRouteName.REGISTER_PROFILE,
component: RegisterProfile, component: RegisterProfile,
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },
{ {
path: '/resend-instructions', path: '/resend-instructions',
name: 'ResendConfirmation', name: UserRouteName.RESEND_CONFIRMATION,
component: ResendConfirmation, component: ResendConfirmation,
props: true, props: true,
meta: { requiresAuth: false }, meta: { requiresAuth: false },
}, },
{ {
path: '/password-reset/send', path: '/password-reset/send',
name: 'SendPasswordReset', name: UserRouteName.SEND_PASSWORD_RESET,
component: SendPasswordReset, component: SendPasswordReset,
props: true, props: true,
meta: { requiresAuth: false }, meta: { requiresAuth: false },
}, },
{ {
path: '/password-reset/:token', path: '/password-reset/:token',
name: 'PasswordReset', name: UserRouteName.PASSWORD_RESET,
component: PasswordReset, component: PasswordReset,
meta: { requiresAuth: false }, meta: { requiresAuth: false },
props: true, props: true,
}, },
{ {
path: '/validate/:token', path: '/validate/:token',
name: 'Validate', name: UserRouteName.VALIDATE,
component: Validate, component: Validate,
// We can only pass string values through params, therefore // We can only pass string values through params, therefore
props: (route) => ({ email: route.params.email, userAlreadyActivated: route.params.userAlreadyActivated === 'true'}), props: (route) => ({ email: route.params.email, userAlreadyActivated: route.params.userAlreadyActivated === 'true' }),
meta: { requiresAuth: false }, meta: { requiresAuth: false },
}, },
{ {
path: '/login', path: '/login',
name: 'Login', name: UserRouteName.LOGIN,
component: Login, component: Login,
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },

View File

@ -69,6 +69,7 @@
import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor"; import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor";
import { Component, Prop, Vue, Watch } from "vue-property-decorator"; import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import EventCard from "@/components/Event/EventCard.vue"; import EventCard from "@/components/Event/EventCard.vue";
import { RouteName } from '@/router'
@Component({ @Component({
apollo: { apollo: {
@ -101,7 +102,7 @@ export default class Profile extends Vue {
logoutUser() { logoutUser() {
// TODO : implement logout // TODO : implement logout
this.$router.push({ name: "Home" }); this.$router.push({ name: RouteName.HOME });
} }
nl2br(text) { nl2br(text) {

View File

@ -80,17 +80,13 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Gravatar from "vue-gravatar";
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
import { IPerson } from "@/types/actor.model"; import { IPerson } from "@/types/actor.model";
import { REGISTER_PERSON } from "@/graphql/actor"; import { REGISTER_PERSON } from "@/graphql/actor";
import { MOBILIZON_INSTANCE_HOST } from "@/api/_entrypoint"; import { MOBILIZON_INSTANCE_HOST } from "@/api/_entrypoint";
import { RouteName } from '@/router'
@Component({ @Component
components: {
"v-gravatar": Gravatar
}
})
export default class Register extends Vue { export default class Register extends Vue {
@Prop({ type: String, required: true }) email!: string; @Prop({ type: String, required: true }) email!: string;
@Prop({ type: Boolean, required: false, default: false }) userAlreadyActivated!: boolean; @Prop({ type: Boolean, required: false, default: false }) userAlreadyActivated!: boolean;
@ -98,20 +94,19 @@ export default class Register extends Vue {
host: string = MOBILIZON_INSTANCE_HOST; host: string = MOBILIZON_INSTANCE_HOST;
person: IPerson = { person: IPerson = {
preferredUsername: "", preferredUsername: '',
name: "", name: '',
summary: "", summary: '',
id: "", id: '',
url: "", url: '',
suspended: false, suspended: false,
avatarUrl: "", // TODO : Use Gravatar here avatarUrl: '',
bannerUrl: "", bannerUrl: '',
domain: null, domain: null,
}; };
errors: object = {}; errors: object = {};
validationSent: boolean = false; validationSent: boolean = false;
sendingValidation: boolean = false; sendingValidation: boolean = false;
showGravatar: boolean = false;
async submit() { async submit() {
try { try {
@ -124,7 +119,7 @@ export default class Register extends Vue {
this.validationSent = true; this.validationSent = true;
if (this.userAlreadyActivated) { if (this.userAlreadyActivated) {
this.$router.push({name: "Home"}); this.$router.push({ name: RouteName.HOME });
} }
} catch (error) { } catch (error) {
this.errors = error.graphQLErrors.reduce((acc, error) => { this.errors = error.graphQLErrors.reduce((acc, error) => {

View File

@ -99,6 +99,7 @@ import { LOGGED_PERSON } from '@/graphql/actor';
import { IEvent, IParticipant } from '@/types/event.model'; import { IEvent, IParticipant } from '@/types/event.model';
import { JOIN_EVENT } from '@/graphql/event'; import { JOIN_EVENT } from '@/graphql/event';
import { IPerson } from '@/types/actor.model'; import { IPerson } from '@/types/actor.model';
import { RouteName } from '@/router'
// No typings for this component, so we use require // No typings for this component, so we use require
const VueMarkdown = require('vue-markdown'); const VueMarkdown = require('vue-markdown');
@ -140,7 +141,7 @@ export default class Event extends Vue {
} }
}); });
router.push({ name: 'EventList' }) router.push({ name: RouteName.EVENT })
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }

View File

@ -19,10 +19,13 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import ngeohash from "ngeohash"; import ngeohash from 'ngeohash';
import VueMarkdown from "vue-markdown"; import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import { Component, Prop, Vue, Watch } from "vue-property-decorator"; import EventCard from '@/components/Event/EventCard.vue';
import EventCard from "@/components/Event/EventCard.vue"; import { RouteName } from '@/router';
// VueMarkdown is untyped
const VueMarkdown = require('vue-markdown');
@Component({ @Component({
components: { components: {
@ -36,7 +39,7 @@ export default class EventList extends Vue {
events = []; events = [];
loading = true; loading = true;
locationChip = false; locationChip = false;
locationText = ""; locationText = '';
created() { created() {
this.fetchData(this.$router.currentRoute.params["location"]); this.fetchData(this.$router.currentRoute.params["location"]);
@ -50,7 +53,7 @@ export default class EventList extends Vue {
@Watch("locationChip") @Watch("locationChip")
onLocationChipChange(val) { onLocationChipChange(val) {
if (val === false) { if (val === false) {
this.$router.push({ name: "EventList" }); this.$router.push({ name: RouteName.EVENT_LIST });
} }
} }
@ -86,7 +89,7 @@ export default class EventList extends Vue {
} }
viewEvent(event) { viewEvent(event) {
this.$router.push({ name: "Event", params: { uuid: event.uuid } }); this.$router.push({ name: RouteName.EVENT, params: { uuid: event.uuid } });
} }
downloadIcsEvent(event) { downloadIcsEvent(event) {

View File

@ -26,9 +26,11 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import VueMarkdown from "vue-markdown";
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from "vue-property-decorator";
// VueMarkdown is untyped
const VueMarkdown = require('vue-markdown')
@Component({ @Component({
components: { components: {
VueMarkdown VueMarkdown
@ -43,9 +45,9 @@ export default class CreateGroup extends Vue {
summary: string; summary: string;
address?: any; address?: any;
} = { } = {
preferred_username: "", preferred_username: '',
name: "", name: '',
summary: "" summary: '',
// category: null, // category: null,
}; };
categories = []; categories = [];

View File

@ -19,7 +19,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from 'vue-property-decorator';
import { RouteName } from '@/router';
@Component @Component
export default class GroupList extends Vue { export default class GroupList extends Vue {
@ -55,7 +56,7 @@ export default class GroupList extends Vue {
viewActor(actor) { viewActor(actor) {
this.$router.push({ this.$router.push({
name: "Group", name: RouteName.GROUP,
params: { name: this.usernameWithDomain(actor) } params: { name: this.usernameWithDomain(actor) }
}); });
} }

View File

@ -37,15 +37,15 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import ngeohash from "ngeohash"; import ngeohash from 'ngeohash';
import { AUTH_USER_ACTOR, AUTH_USER_ID } from "@/constants"; import { FETCH_EVENTS } from '@/graphql/event';
import { FETCH_EVENTS } from "@/graphql/event"; import { Component, Vue } from 'vue-property-decorator';
import { Component, Vue } from "vue-property-decorator"; import EventCard from '@/components/Event/EventCard.vue';
import EventCard from "@/components/Event/EventCard.vue"; import { LOGGED_PERSON } from '@/graphql/actor';
import { LOGGED_PERSON } from "@/graphql/actor"; import { IPerson } from '@/types/actor.model';
import { IPerson } from "@/types/actor.model"; import { ICurrentUser } from '@/types/current-user.model';
import { ICurrentUser } from "@/types/current-user.model"; import { CURRENT_USER_CLIENT } from '@/graphql/user';
import { CURRENT_USER_CLIENT } from "@/graphql/user"; import { RouteName } from '@/router';
@Component({ @Component({
apollo: { apollo: {
@ -95,40 +95,44 @@ export default class Home extends Vue {
geoLocalize() { geoLocalize() {
const router = this.$router; const router = this.$router;
const sessionCity = sessionStorage.getItem("City"); const sessionCity = sessionStorage.getItem('City');
if (sessionCity) {
router.push({ name: "EventList", params: { location: sessionCity } });
} else {
navigator.geolocation.getCurrentPosition(
pos => {
const crd = pos.coords;
const geohash = ngeohash.encode(crd.latitude, crd.longitude, 11); if (sessionCity) {
sessionStorage.setItem("City", geohash); return router.push({ name: 'EventList', params: { location: sessionCity } });
router.push({ name: "EventList", params: { location: geohash } });
},
err => console.warn(`ERROR(${err.code}): ${err.message}`),
{
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
}
);
} }
navigator.geolocation.getCurrentPosition(
pos => {
const crd = pos.coords;
const geoHash = ngeohash.encode(crd.latitude, crd.longitude, 11);
sessionStorage.setItem('City', geoHash);
router.push({ name: RouteName.EVENT_LIST, params: { location: geoHash } });
},
err => console.warn(`ERROR(${err.code}): ${err.message}`),
{
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0,
},
);
} }
getAddressData(addressData) { getAddressData(addressData) {
const geohash = ngeohash.encode( const geoHash = ngeohash.encode(
addressData.latitude, addressData.latitude,
addressData.longitude, addressData.longitude,
11 11
); );
sessionStorage.setItem("City", geohash); sessionStorage.setItem("City", geoHash);
this.$router.push({ name: "EventList", params: { location: geohash } });
this.$router.push({ name: RouteName.EVENT_LIST, params: { location: geoHash } });
} }
viewEvent(event) { viewEvent(event) {
this.$router.push({ name: "Event", params: { uuid: event.uuid } }); this.$router.push({ name: RouteName.EVENT, params: { uuid: event.uuid } });
} }
ipLocation() { ipLocation() {

View File

@ -53,7 +53,6 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Gravatar from "vue-gravatar";
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
import { LOGIN } from "@/graphql/auth"; import { LOGIN } from "@/graphql/auth";
import { validateEmailField, validateRequiredField } from "@/utils/validators"; import { validateEmailField, validateRequiredField } from "@/utils/validators";
@ -61,12 +60,9 @@ import { saveUserData } from "@/utils/auth";
import { ILogin } from "@/types/login.model"; import { ILogin } from "@/types/login.model";
import { UPDATE_CURRENT_USER_CLIENT } from "@/graphql/user"; import { UPDATE_CURRENT_USER_CLIENT } from "@/graphql/user";
import { onLogin } from "@/vue-apollo"; import { onLogin } from "@/vue-apollo";
import { RouteName } from '@/router'
@Component({ @Component
components: {
"v-gravatar": Gravatar
}
})
export default class Login extends Vue { export default class Login extends Vue {
@Prop({ type: String, required: false, default: "" }) email!: string; @Prop({ type: String, required: false, default: "" }) email!: string;
@Prop({ type: String, required: false, default: "" }) password!: string; @Prop({ type: String, required: false, default: "" }) password!: string;
@ -85,7 +81,7 @@ export default class Login extends Vue {
beforeCreate() { beforeCreate() {
if (this.user) { if (this.user) {
this.$router.push("/"); this.$router.push('/');
} }
} }
@ -119,7 +115,7 @@ export default class Login extends Vue {
onLogin(this.$apollo); onLogin(this.$apollo);
this.$router.push({ name: "Home" }); this.$router.push({ name: RouteName.HOME });
} catch (err) { } catch (err) {
console.error(err); console.error(err);
err.graphQLErrors.forEach(({ message }) => { err.graphQLErrors.forEach(({ message }) => {
@ -127,11 +123,5 @@ export default class Login extends Vue {
}); });
} }
} }
validEmail() {
return this.rules.email(this.credentials.email) === true
? "v-gravatar"
: "avatar";
}
} }
</script> </script>

View File

@ -40,6 +40,7 @@ import { validateRequiredField } from "@/utils/validators";
import { RESET_PASSWORD } from "@/graphql/auth"; import { RESET_PASSWORD } from "@/graphql/auth";
import { saveUserData } from "@/utils/auth"; import { saveUserData } from "@/utils/auth";
import { ILogin } from "@/types/login.model"; import { ILogin } from "@/types/login.model";
import { RouteName } from '@/router'
@Component @Component
export default class PasswordReset extends Vue { export default class PasswordReset extends Vue {
@ -79,7 +80,7 @@ export default class PasswordReset extends Vue {
}); });
saveUserData(result.data.resetPassword); saveUserData(result.data.resetPassword);
this.$router.push({ name: "Home" }); this.$router.push({ name: RouteName.HOME });
} catch (err) { } catch (err) {
console.error(err); console.error(err);
err.graphQLErrors.forEach(({ message }) => { err.graphQLErrors.forEach(({ message }) => {

View File

@ -108,15 +108,11 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Gravatar from "vue-gravatar";
import { CREATE_USER } from "@/graphql/user"; import { CREATE_USER } from "@/graphql/user";
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
import { UserRouteName } from '@/router/user'
@Component({ @Component
components: {
"v-gravatar": Gravatar
}
})
export default class Register extends Vue { export default class Register extends Vue {
@Prop({ type: String, required: false, default: "" }) email!: string; @Prop({ type: String, required: false, default: "" }) email!: string;
@Prop({ type: String, required: false, default: "" }) password!: string; @Prop({ type: String, required: false, default: "" }) password!: string;
@ -124,29 +120,25 @@ export default class Register extends Vue {
credentials = { credentials = {
email: this.email, email: this.email,
password: this.password password: this.password
} as { email: string; password: string }; }
errors: object = {}; errors: object = {};
sendingValidation: boolean = false; sendingValidation: boolean = false;
validationSent: boolean = false; validationSent: boolean = false;
showGravatar: boolean = false;
validEmail() {
return this.credentials.email.includes("@") === true
? "v-gravatar"
: "avatar";
}
async submit() { async submit() {
try { try {
this.sendingValidation = true; this.sendingValidation = true;
this.errors = {}; this.errors = {};
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: CREATE_USER, mutation: CREATE_USER,
variables: this.credentials variables: this.credentials
}); });
this.validationSent = true; this.validationSent = true;
this.$router.push({ this.$router.push({
name: "RegisterProfile", name: UserRouteName.REGISTER_PROFILE,
params: { email: this.credentials.email } params: { email: this.credentials.email }
}); });
} catch (error) { } catch (error) {

View File

@ -20,6 +20,8 @@
import { VALIDATE_USER } from "@/graphql/user"; import { VALIDATE_USER } from "@/graphql/user";
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
import { AUTH_TOKEN, AUTH_USER_ID } from "@/constants"; import { AUTH_TOKEN, AUTH_USER_ID } from "@/constants";
import { RouteName } from '@/router'
import { UserRouteName } from '@/router/user'
@Component @Component
export default class Validate extends Vue { export default class Validate extends Vue {
@ -46,9 +48,9 @@ export default class Validate extends Vue {
const user = data.validateUser.user; const user = data.validateUser.user;
console.log(user); console.log(user);
if (user.defaultActor) { if (user.defaultActor) {
this.$router.push({name: "Home"}); this.$router.push({ name: RouteName.HOME });
} else { // If the user didn't register any profile yet, let's create one for them } else { // If the user didn't register any profile yet, let's create one for them
this.$router.push({ name: 'RegisterProfile', params: {email: user.email, userAlreadyActivated: 'true'} }); this.$router.push({ name: UserRouteName.REGISTER_PROFILE, params: { email: user.email, userAlreadyActivated: 'true' } });
} }
} catch (err) { } catch (err) {
console.error(err); console.error(err);