Organisation and reworking stuff
Former-commit-id: 01621444e51316cc9f125e4d541caf9d6c9d37a1 [formerly 733a976b594348754cb34b27c594c485fd5b0df4] [formerly 36a2f39b0e471ee231343ebaed474ae247764b37 [formerly 8d891f0d51]]
Former-commit-id: 505c381e3135c0e0607e984a37e908672e8100a3 [formerly a6e70288608c6ee1edc380af76ee3e82ff62861a]
Former-commit-id: d946069b4f8ad1b19da7ee087901762b3f4b7936
This commit is contained in:
1 parent
8b98abedea
commit
bae3c341f6
23 files changed
+47
-87
No files matched your search
@@ -10,7 +10,6 @@ function fetch (url) {
|
||||
if (request.status === 200) {
|
||||
let req = JSON.parse(request.responseText)
|
||||
store.commit('updateRequest', req)
|
||||
console.log(req)
|
||||
document.title = req.name
|
||||
resolve()
|
||||
} else {
|
||||
|
||||
@@ -1,36 +1,3 @@
|
||||
import store from '../store/store'
|
||||
|
||||
function open (url, history) {
|
||||
// Reset info
|
||||
store.commit('resetSelected')
|
||||
store.commit('multiple', false)
|
||||
|
||||
let request = new window.XMLHttpRequest()
|
||||
request.open('GET', url, true)
|
||||
request.setRequestHeader('Accept', 'application/json')
|
||||
|
||||
request.onload = () => {
|
||||
if (request.status === 200) {
|
||||
let req = JSON.parse(request.responseText)
|
||||
store.commit('updateRequest', req)
|
||||
|
||||
if (history) {
|
||||
window.history.pushState({
|
||||
name: req.data.name,
|
||||
url: url
|
||||
}, req.data.name, url)
|
||||
|
||||
document.title = req.data.name
|
||||
}
|
||||
} else {
|
||||
console.log(request.responseText)
|
||||
}
|
||||
}
|
||||
|
||||
request.onerror = (error) => { console.log(error) }
|
||||
request.send()
|
||||
}
|
||||
|
||||
function removeLastDir (url) {
|
||||
var arr = url.split('/')
|
||||
if (arr.pop() === '') {
|
||||
@@ -41,11 +8,5 @@ function removeLastDir (url) {
|
||||
}
|
||||
|
||||
export default {
|
||||
reload: () => {
|
||||
open(window.location.pathname, false)
|
||||
},
|
||||
open: (url) => {
|
||||
open(url, true)
|
||||
},
|
||||
removeLastDir: removeLastDir
|
||||
}
|
||||
Reference in new issue
Block a user