From 53cb39350ae92b5955783777e00cc293e8f5950e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 22 Feb 2019 14:55:47 +0100 Subject: [PATCH] Refactor router --- js/package-lock.json | 142 +++++++++++----------------- js/package.json | 1 - js/src/components/NavBar.vue | 22 +++-- js/src/router/actor.ts | 48 ++++++++++ js/src/router/category.ts | 22 +++++ js/src/router/event.ts | 47 +++++++++ js/src/router/index.ts | 116 +++++------------------ js/src/router/user.ts | 28 ++++-- js/src/views/Account/Profile.vue | 3 +- js/src/views/Account/Register.vue | 25 ++--- js/src/views/Event/Event.vue | 3 +- js/src/views/Event/EventList.vue | 17 ++-- js/src/views/Group/Create.vue | 10 +- js/src/views/Group/GroupList.vue | 5 +- js/src/views/Home.vue | 66 +++++++------ js/src/views/User/Login.vue | 18 +--- js/src/views/User/PasswordReset.vue | 3 +- js/src/views/User/Register.vue | 22 ++--- js/src/views/User/Validate.vue | 6 +- 19 files changed, 316 insertions(+), 288 deletions(-) create mode 100644 js/src/router/actor.ts create mode 100644 js/src/router/category.ts create mode 100644 js/src/router/event.ts diff --git a/js/package-lock.json b/js/package-lock.json index e6cd2de44..54ab6e9b2 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -1833,7 +1833,7 @@ "dependencies": { "semver": { "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=", "dev": true } @@ -2150,7 +2150,7 @@ }, "array-equal": { "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=", "dev": true }, @@ -2282,7 +2282,7 @@ }, "async": { "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=", "dev": true }, @@ -2367,7 +2367,7 @@ }, "chalk": { "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=", "dev": true, "requires": { @@ -2386,7 +2386,7 @@ }, "strip-ansi": { "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=", "dev": true, "requires": { @@ -3038,7 +3038,7 @@ }, "camelcase-keys": { "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=", "dev": true, "requires": { @@ -3164,11 +3164,6 @@ "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": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -3196,7 +3191,7 @@ "dependencies": { "css-select": { "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=", "requires": { "boolbase": "~1.0.0", @@ -3427,7 +3422,7 @@ }, "get-stream": { "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=", "dev": true } @@ -4010,11 +4005,6 @@ "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": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", @@ -4042,7 +4032,7 @@ }, "css-color-names": { "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=", "dev": true }, @@ -4149,7 +4139,7 @@ }, "jsesc": { "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=", "dev": true }, @@ -4166,13 +4156,13 @@ }, "regjsgen": { "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=", "dev": true }, "regjsparser": { "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=", "dev": true, "requires": { @@ -4412,7 +4402,7 @@ }, "deep-eql": { "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=", "dev": true, "requires": { @@ -4470,7 +4460,7 @@ }, "get-stream": { "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=", "dev": true } @@ -4774,7 +4764,7 @@ }, "duplexer": { "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=", "dev": true }, @@ -5497,7 +5487,7 @@ }, "finalhandler": { "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==", "dev": true, "requires": { @@ -6277,7 +6267,7 @@ }, "readable-stream": { "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=", "dev": true, "requires": { @@ -6344,7 +6334,7 @@ }, "strip-ansi": { "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=", "dev": true, "requires": { @@ -6495,7 +6485,7 @@ }, "globby": { "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=", "dev": true, "requires": { @@ -6508,7 +6498,7 @@ "dependencies": { "pify": { "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=", "dev": true } @@ -6843,7 +6833,7 @@ }, "html-webpack-plugin": { "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=", "dev": true, "requires": { @@ -6872,7 +6862,7 @@ }, "htmlparser2": { "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=", "dev": true, "requires": { @@ -6899,7 +6889,7 @@ }, "readable-stream": { "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=", "dev": true, "requires": { @@ -6925,7 +6915,7 @@ }, "http-errors": { "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=", "dev": true, "requires": { @@ -6982,7 +6972,7 @@ }, "http-proxy-middleware": { "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==", "dev": true, "requires": { @@ -8443,16 +8433,6 @@ "resolved": "https://registry.npmjs.org/material-design-icons/-/material-design-icons-3.0.1.tgz", "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": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -8477,7 +8457,7 @@ }, "media-typer": { "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=", "dev": true }, @@ -8504,7 +8484,7 @@ }, "meow": { "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=", "dev": true, "requires": { @@ -8729,7 +8709,7 @@ }, "mkdirp": { "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=", "dev": true, "requires": { @@ -8777,7 +8757,7 @@ }, "commander": { "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==", "dev": true }, @@ -8863,7 +8843,7 @@ }, "debug": { "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=", "dev": true, "requires": { @@ -8892,7 +8872,7 @@ }, "ms": { "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=", "dev": true }, @@ -9284,7 +9264,7 @@ "dependencies": { "semver": { "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=", "dev": true } @@ -9390,7 +9370,7 @@ }, "chalk": { "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=", "dev": true, "requires": { @@ -9413,7 +9393,7 @@ }, "strip-ansi": { "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=", "dev": true, "requires": { @@ -9755,7 +9735,7 @@ }, "os-homedir": { "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=", "dev": true }, @@ -9772,7 +9752,7 @@ }, "os-tmpdir": { "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=", "dev": true }, @@ -10074,7 +10054,7 @@ }, "path-is-absolute": { "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=", "dev": true }, @@ -10794,7 +10774,7 @@ }, "pretty-bytes": { "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=", "dev": true }, @@ -10883,7 +10863,7 @@ }, "lru-cache": { "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=", "dev": true }, @@ -11017,7 +10997,7 @@ }, "yargs": { "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=", "requires": { "camelcase": "^1.0.2", @@ -11254,7 +11234,7 @@ }, "pify": { "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=", "dev": true }, @@ -11429,7 +11409,7 @@ "dependencies": { "jsesc": { "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=", "dev": true } @@ -11468,7 +11448,7 @@ }, "css-select": { "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=", "dev": true, "requires": { @@ -11490,7 +11470,7 @@ }, "strip-ansi": { "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=", "dev": true, "requires": { @@ -11705,7 +11685,7 @@ }, "safe-regex": { "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=", "dev": true, "requires": { @@ -11779,7 +11759,7 @@ }, "os-locale": { "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=", "dev": true, "requires": { @@ -11799,7 +11779,7 @@ }, "strip-ansi": { "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=", "dev": true, "requires": { @@ -11901,7 +11881,7 @@ "dependencies": { "source-map": { "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=", "dev": true, "requires": { @@ -12702,7 +12682,7 @@ }, "strip-eof": { "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=", "dev": true }, @@ -12805,7 +12785,7 @@ }, "tar": { "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=", "dev": true, "requires": { @@ -13762,14 +13742,6 @@ "resolved": "https://registry.npmjs.org/vue-gettext/-/vue-gettext-2.1.2.tgz", "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": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.1.tgz", @@ -14095,7 +14067,7 @@ }, "strip-ansi": { "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=", "dev": true, "requires": { @@ -14278,7 +14250,7 @@ "dependencies": { "acorn": { "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=" }, "acorn-globals": { @@ -14354,7 +14326,7 @@ "dependencies": { "hoek": { "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==", "dev": true }, @@ -14371,7 +14343,7 @@ }, "topo": { "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=", "dev": true, "requires": { @@ -14498,7 +14470,7 @@ }, "wrap-ansi": { "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=", "dev": true, "requires": { @@ -14534,7 +14506,7 @@ }, "strip-ansi": { "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=", "dev": true, "requires": { @@ -14689,7 +14661,7 @@ }, "get-stream": { "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=", "dev": true }, diff --git a/js/package.json b/js/package.json index 0a16c1afb..1a8f8a95d 100644 --- a/js/package.json +++ b/js/package.json @@ -30,7 +30,6 @@ "vue-apollo": "^3.0.0-beta.28", "vue-class-component": "^6.3.2", "vue-gettext": "^2.1.2", - "vue-gravatar": "^1.3.0", "vue-markdown": "^2.2.4", "vue-property-decorator": "^7.3.0", "vue-router": "^3.0.2", diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue index e9fc3917f..31ef9b0b7 100644 --- a/js/src/components/NavBar.vue +++ b/js/src/components/NavBar.vue @@ -50,7 +50,8 @@ import { CURRENT_USER_CLIENT } from "@/graphql/user"; import { onLogout } from "@/vue-apollo"; import { deleteUserData } from "@/utils/auth"; import { LOGGED_PERSON } from "@/graphql/actor"; -import { IPerson } from "../types/actor.model"; +import { IActor, IPerson } from '../types/actor.model'; +import { RouteName } from '@/router' @Component({ apollo: { @@ -100,25 +101,26 @@ export default class NavBar extends Vue { }); } - @Watch("model") + @Watch('model') onModelChanged(val) { switch (val.__typename) { - case "Event": - this.$router.push({ name: "Event", params: { uuid: val.uuid } }); + case 'Event': + this.$router.push({ name: RouteName.EVENT, params: { uuid: val.uuid } }); break; - case "Actor": + + case 'Actor': this.$router.push({ - name: "Profile", - params: { name: this.username_with_domain(val) } + name: RouteName.PROFILE, + params: { name: this.usernameWithDomain(val) }, }); break; } } - username_with_domain(actor) { + usernameWithDomain(actor: IActor) { return ( actor.preferredUsername + - (actor.domain === null ? "" : `@${actor.domain}`) + (actor.domain === null ? '' : `@${actor.domain}`) ); } @@ -128,7 +130,7 @@ export default class NavBar extends Vue { } logout() { - alert("logout !"); + alert('logout !'); deleteUserData(); diff --git a/js/src/router/actor.ts b/js/src/router/actor.ts new file mode 100644 index 000000000..56fc2d1d6 --- /dev/null +++ b/js/src/router/actor.ts @@ -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 }, + }, +]; diff --git a/js/src/router/category.ts b/js/src/router/category.ts new file mode 100644 index 000000000..1dee45401 --- /dev/null +++ b/js/src/router/category.ts @@ -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 }, + }, +]; diff --git a/js/src/router/event.ts b/js/src/router/event.ts new file mode 100644 index 000000000..18562c378 --- /dev/null +++ b/js/src/router/event.ts @@ -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 }, + }, +]; diff --git a/js/src/router/index.ts b/js/src/router/index.ts index 817b50dd2..aa259fcd4 100644 --- a/js/src/router/index.ts +++ b/js/src/router/index.ts @@ -2,111 +2,47 @@ import Vue from 'vue'; import Router from 'vue-router'; import PageNotFound from '@/views/PageNotFound.vue'; import Home from '@/views/Home.vue'; -import Event from '@/views/Event/Event.vue'; -import EventList from '@/views/Event/EventList.vue'; -import Location from '@/views/Location.vue'; -import CreateEvent from '@/views/Event/Create.vue'; -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'; +import { UserRouteName, userRoutes } from './user'; +import { EventRouteName, eventRoutes } from '@/router/event'; +import { ActorRouteName, actorRoutes } from '@/router/actor'; +import { CategoryRouteName, categoryRoutes } from '@/router/category'; 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({ mode: 'history', base: '/', routes: [ ...userRoutes, + ...eventRoutes, + ...categoryRoutes, + ...actorRoutes, + { path: '/', - name: 'Home', + name: RouteName.HOME, component: Home, 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: '*', - name: 'PageNotFound', + name: RouteName.PAGE_NOT_FOUND, component: PageNotFound, meta: { requiredAuth: false }, }, diff --git a/js/src/router/user.ts b/js/src/router/user.ts index 24bb0b98e..3e2de9335 100644 --- a/js/src/router/user.ts +++ b/js/src/router/user.ts @@ -6,53 +6,63 @@ import ResendConfirmation from '@/views/User/ResendConfirmation.vue'; import SendPasswordReset from '@/views/User/SendPasswordReset.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', - name: 'Register', + name: UserRouteName.REGISTER, component: RegisterUser, props: true, meta: { requiredAuth: false }, }, { path: '/register/profile', - name: 'RegisterProfile', + name: UserRouteName.REGISTER_PROFILE, component: RegisterProfile, props: true, meta: { requiredAuth: false }, }, { path: '/resend-instructions', - name: 'ResendConfirmation', + name: UserRouteName.RESEND_CONFIRMATION, component: ResendConfirmation, props: true, meta: { requiresAuth: false }, }, { path: '/password-reset/send', - name: 'SendPasswordReset', + name: UserRouteName.SEND_PASSWORD_RESET, component: SendPasswordReset, props: true, meta: { requiresAuth: false }, }, { path: '/password-reset/:token', - name: 'PasswordReset', + name: UserRouteName.PASSWORD_RESET, component: PasswordReset, meta: { requiresAuth: false }, props: true, }, { path: '/validate/:token', - name: 'Validate', + name: UserRouteName.VALIDATE, component: Validate, // 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 }, }, { path: '/login', - name: 'Login', + name: UserRouteName.LOGIN, component: Login, props: true, meta: { requiredAuth: false }, diff --git a/js/src/views/Account/Profile.vue b/js/src/views/Account/Profile.vue index a06f9d716..33d7f8d32 100644 --- a/js/src/views/Account/Profile.vue +++ b/js/src/views/Account/Profile.vue @@ -69,6 +69,7 @@ import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor"; import { Component, Prop, Vue, Watch } from "vue-property-decorator"; import EventCard from "@/components/Event/EventCard.vue"; +import { RouteName } from '@/router' @Component({ apollo: { @@ -101,7 +102,7 @@ export default class Profile extends Vue { logoutUser() { // TODO : implement logout - this.$router.push({ name: "Home" }); + this.$router.push({ name: RouteName.HOME }); } nl2br(text) { diff --git a/js/src/views/Account/Register.vue b/js/src/views/Account/Register.vue index 0e9b2a727..a80e76e9e 100644 --- a/js/src/views/Account/Register.vue +++ b/js/src/views/Account/Register.vue @@ -80,17 +80,13 @@ diff --git a/js/src/views/User/PasswordReset.vue b/js/src/views/User/PasswordReset.vue index 1b0eae57b..7fb58109b 100644 --- a/js/src/views/User/PasswordReset.vue +++ b/js/src/views/User/PasswordReset.vue @@ -40,6 +40,7 @@ import { validateRequiredField } from "@/utils/validators"; import { RESET_PASSWORD } from "@/graphql/auth"; import { saveUserData } from "@/utils/auth"; import { ILogin } from "@/types/login.model"; +import { RouteName } from '@/router' @Component export default class PasswordReset extends Vue { @@ -79,7 +80,7 @@ export default class PasswordReset extends Vue { }); saveUserData(result.data.resetPassword); - this.$router.push({ name: "Home" }); + this.$router.push({ name: RouteName.HOME }); } catch (err) { console.error(err); err.graphQLErrors.forEach(({ message }) => { diff --git a/js/src/views/User/Register.vue b/js/src/views/User/Register.vue index ed4a654c1..12fcc9051 100644 --- a/js/src/views/User/Register.vue +++ b/js/src/views/User/Register.vue @@ -108,15 +108,11 @@