Skip to content

Commit

Permalink
Fixes: Mobile - Possible 404 because of mobile detection redirect fro…
Browse files Browse the repository at this point in the history
…m desktop view
  • Loading branch information
mantas committed Mar 24, 2023
1 parent e911a75 commit c8c430b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions app/frontend/apps/mobile/pages/home/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ const route: RouteRecordRaw[] = [
component: () => import('./views/Home.vue'),
beforeEnter(to) {
const location = to.hash && to.hash.slice(1)
if (location) {
const route = Router.resolve(location)
if (route.name !== 'Error') {
return `/${location}`
}
}

if (!location) return true

const route = Router.resolve(location)
const path = route.name === 'Error' ? '/' : `/${location}`

return { path, replace: true }
},
meta: {
title: __('Home'),
Expand Down
2 changes: 1 addition & 1 deletion spec/system/apps/mobile/app_links_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
it_behaves_like 'redirecting to mobile app', 'ticket/create', 'ticket/create', authenticated: true
it_behaves_like 'redirecting to mobile app', 'ticket/zoom/1', 'ticket/zoom/1', authenticated: true
it_behaves_like 'redirecting to mobile app', 'user/profile/1', 'user/profile/1', authenticated: true
it_behaves_like 'redirecting to mobile app', 'dashboard', '#dashboard', authenticated: true
it_behaves_like 'redirecting to mobile app', 'dashboard', %r{mobile/$}, authenticated: true

context 'with customer user', authenticated_as: :customer do
let(:customer) { create(:customer) }
Expand Down

0 comments on commit c8c430b

Please sign in to comment.