feat: use web history mode
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
parent
79ce0ac15a
commit
ecb2afe568
|
@ -21,10 +21,29 @@
|
|||
*/
|
||||
return [
|
||||
'routes' => [
|
||||
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
|
||||
['name' => 'collections#getCollections','url' => '/collections', 'verb' => 'GET'],
|
||||
['name' => 'collections#setVisibility', 'url' => '/collection/{collectionID}/visibility/{visibility}', 'verb' => 'POST'],
|
||||
['name' => 'settings#get', 'url' => '/settings', 'verb' => 'GET'],
|
||||
['name' => 'settings#set', 'url' => '/settings/{setting}', 'verb' => 'POST'],
|
||||
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
|
||||
['name' => 'page#index', 'url' => '/calendars', 'verb' => 'GET', 'postfix' => 'view.calendars'],
|
||||
['name' => 'page#index', 'url' => '/calendars/', 'verb' => 'GET', 'postfix' => 'view.calendars./'],
|
||||
[
|
||||
'name' => 'page#index',
|
||||
'url' => '/calendars/{calendar}',
|
||||
'verb' => 'GET',
|
||||
'postfix' => 'view.calendars.calendar',
|
||||
'requirements' => array('calendar' => '.+')
|
||||
],
|
||||
['name' => 'page#index', 'url' => '/collections', 'verb' => 'GET', 'postfix' => 'view.collections'],
|
||||
['name' => 'page#index', 'url' => '/collections/', 'verb' => 'GET', 'postfix' => 'view.collections./'],
|
||||
[
|
||||
'name' => 'page#index',
|
||||
'url' => '/collections/{collection}',
|
||||
'verb' => 'GET',
|
||||
'postfix' => 'view.collections.collection',
|
||||
'requirements' => array('collection' => '.+')
|
||||
],
|
||||
|
||||
['name' => 'collections#getCollections','url' => '/api/v1/collections', 'verb' => 'GET'],
|
||||
['name' => 'collections#setVisibility', 'url' => '/api/v1/collection/{collectionID}/visibility/{visibility}', 'verb' => 'POST'],
|
||||
['name' => 'settings#get', 'url' => '/api/v1/settings', 'verb' => 'GET'],
|
||||
['name' => 'settings#set', 'url' => '/api/v1/settings/{setting}', 'verb' => 'POST'],
|
||||
]
|
||||
];
|
||||
|
|
|
@ -25,8 +25,16 @@ import AppSidebar from './views/AppSidebar.vue'
|
|||
import Calendar from './views/AppContent/Calendar.vue'
|
||||
import Collections from './views/AppContent/Collections.vue'
|
||||
|
||||
import { getRootUrl, generateUrl } from '@nextcloud/router'
|
||||
|
||||
import { h } from 'vue'
|
||||
import { createWebHashHistory, createRouter, RouterView } from 'vue-router'
|
||||
import { createWebHistory, createRouter, RouterView } from 'vue-router'
|
||||
|
||||
const webRootWithIndexPHP = getRootUrl() + '/index.php'
|
||||
const doesURLContainIndexPHP = window.location.pathname.startsWith(webRootWithIndexPHP)
|
||||
const base = generateUrl('apps/tasks', {}, {
|
||||
noRewrite: doesURLContainIndexPHP,
|
||||
})
|
||||
|
||||
const routes = [
|
||||
{ path: '/', redirect: getInitialRoute() },
|
||||
|
@ -81,7 +89,7 @@ const routes = [
|
|||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
history: createWebHistory(base),
|
||||
routes,
|
||||
})
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ const actions = {
|
|||
*/
|
||||
loadCollections({ commit }) {
|
||||
return new Promise(function(resolve) {
|
||||
Requests.get(generateUrl('apps/tasks/collections'))
|
||||
Requests.get(generateUrl('apps/tasks/api/v1/collections'))
|
||||
.then(response => {
|
||||
commit('setCollections', {
|
||||
collections: response.data.data.collections,
|
||||
|
@ -123,7 +123,7 @@ const actions = {
|
|||
setVisibility(context, collection) {
|
||||
context.commit('setVisibility', collection)
|
||||
return new Promise(function() {
|
||||
Requests.post(generateUrl('apps/tasks/collection/{id}/visibility/{show}', collection), {})
|
||||
Requests.post(generateUrl('apps/tasks/api/v1/collection/{id}/visibility/{show}', collection), {})
|
||||
})
|
||||
},
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ const actions = {
|
|||
setSetting(context, payload) {
|
||||
context.commit('setSetting', payload)
|
||||
return new Promise(function() {
|
||||
Requests.post(generateUrl('apps/tasks/settings/{type}', payload), { value: payload.value })
|
||||
Requests.post(generateUrl('apps/tasks/api/v1/settings/{type}', payload), { value: payload.value })
|
||||
})
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue