почему не приходит ответ из базы indexedDB при запросе чепрез url?

Не понимаю в чем дело. Когда делаю запрос через this.$router.push({name: 'TodoPage', params: { id: todo.id,}}) все отрабатывает и приходит обьект из базы (ID : 60|Todo found Object|Transaction Oncomplete result: 60), но при запросе через строку браузера localhost/todo/id (ID : 60|Todo found undefined TypeError: Cannot read property 'id' of undefined)

indexedDB

async getTodo(id) {
        let db = await this.getDb();
        console.log('ID : ' + id);
        return new Promise(resolve => {
            let transaction = db.transaction(['todos'], 'readonly');
            transaction.oncomplete = () => {
                console.log('Transaction Oncomplete result: ' + todo.result.id); 
                //'Transaction Oncomplete result + underfined
                resolve(todo.result);
            };
            transaction.onerror = function () {
                console.log('Transaction not opened todo to error');
            };
            let todos = transaction.objectStore('todos');
            todos.onsuccess = function () {
                console.log("Todos found", JSON.stringify(todos));
            };
            todos.onerror = function () {
                console.log("Error TODOS", todos.error);
                todos = {}
            };
            let todo = todos.get(id);
            todo.onsuccess = function () {
                console.log("Todo found", todo.result);
            };
            todo.onerror = function () {
                console.log("Error", todo.error);
                todo = {}
            };
        })
    },

TodoPage

async beforeMount() {
        if(this.$route.params.id){
                this.todo = await idb.getTodo(this.todo.id);
            }
    },



Ответы (0 шт):