diff --git a/Gemfile b/Gemfile index 19ebae43..9ba7f175 100644 --- a/Gemfile +++ b/Gemfile @@ -54,8 +54,8 @@ group :development do # Makes spring watch files using the listen gem. (https://github.com/jonleighton/spring-watcher-listen) gem 'spring-watcher-listen', '~> 2.0.0' - # Brings Rails named routes to javascript (http://github.com/railsware/js-routes) - gem 'js-routes', require: false + # Brings Rails named routes to modern javascript (https://github.com/elmassimo/js_from_routes) + gem 'js_from_routes' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index a6b457ae..603dc190 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -108,8 +108,8 @@ GEM rails (>= 5) jbuilder (2.11.1) activesupport (>= 5.0.0) - js-routes (1.4.14) - railties (>= 4) + js_from_routes (1.0.1) + railties listen (3.4.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -267,7 +267,7 @@ DEPENDENCIES image_processing (~> 1.10) inertia_rails (>= 1.2.2) jbuilder (~> 2.7) - js-routes + js_from_routes listen (~> 3.3) oj pagy diff --git a/app/javascript/Layouts/Main.vue b/app/javascript/Layouts/Main.vue index d7f718b7..efe8ae35 100644 --- a/app/javascript/Layouts/Main.vue +++ b/app/javascript/Layouts/Main.vue @@ -8,7 +8,7 @@
@@ -62,20 +62,20 @@ My Profile Manage Users @@ -108,6 +108,10 @@ import Icon from '@/Shared/Icon.vue' import Logo from '@/Shared/Logo.vue' import MainMenu from '@/Shared/MainMenu.vue' +import DashboardRequests from '@/requests/DashboardRequests' +import UsersRequests from '@/requests/UsersRequests' +import SessionsRequests from '@/requests/Users/SessionsRequests' + export default { components: { MinimalLayout, @@ -117,5 +121,15 @@ export default { Logo, MainMenu, }, + computed: { + routes () { + return { + dashboard: DashboardRequests.pathFor('list'), + profile: UsersRequests.pathFor('edit', this.$page.props.auth.user), + users: UsersRequests.pathFor('list'), + signOut: SessionsRequests.pathFor('destroy'), + } + }, + }, } diff --git a/app/javascript/Pages/Auth/Login.vue b/app/javascript/Pages/Auth/Login.vue index 4529a4c0..9d10c488 100644 --- a/app/javascript/Pages/Auth/Login.vue +++ b/app/javascript/Pages/Auth/Login.vue @@ -7,7 +7,7 @@ />
@@ -68,6 +68,7 @@ import FlashMessages from '@/Shared/FlashMessages.vue' import LoadingButton from '@/Shared/LoadingButton.vue' import Logo from '@/Shared/Logo.vue' import TextInput from '@/Shared/TextInput.vue' +import SessionsRequests from '@/requests/Users/SessionsRequests' export default { metaInfo: { title: 'Login' }, @@ -89,5 +90,10 @@ export default { }), } }, + methods: { + login (form) { + SessionsRequests.create({ form }) + }, + }, } diff --git a/app/javascript/Pages/Contacts/Edit.vue b/app/javascript/Pages/Contacts/Edit.vue index 472f55d7..66366c58 100644 --- a/app/javascript/Pages/Contacts/Edit.vue +++ b/app/javascript/Pages/Contacts/Edit.vue @@ -3,7 +3,7 @@

Contacts @@ -21,7 +21,7 @@