fix query

This commit is contained in:
AlphaX-Projects 2023-06-12 19:50:30 +02:00
parent 7934c88782
commit acdf276e7c

View File

@ -490,6 +490,12 @@ class NavBar extends connect(store)(LitElement) {
} }
` `
getApiKey() {
const apiNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
let apiKey = apiNode.apiKey
return apiKey
}
async extractComponents(url) { async extractComponents(url) {
if (!url.startsWith("qortal://")) { if (!url.startsWith("qortal://")) {
return null return null
@ -509,11 +515,11 @@ class NavBar extends connect(store)(LitElement) {
// Check if a resource exists with this service, name and identifier combination // Check if a resource exists with this service, name and identifier combination
const myNode = store.getState().app.nodeConfig.knownNodes[store.getState().app.nodeConfig.node] const myNode = store.getState().app.nodeConfig.knownNodes[store.getState().app.nodeConfig.node]
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
let responseObj = await parentEpml.request('apiCall', { const url = `${nodeUrl}/arbitrary/resource/status/${service}/${name}/${identifier}?apiKey=${myNode.apiKey}}`
url: `${nodeUrl}/arbitrary/resource/status/${service}/${name}/${identifier}?apiKey=${myNode.apiKey}}`
})
if (responseObj.totalChunkCount > 0) { const res = await fetch(url);
const data = await res.json();
if (data.totalChunkCount > 0) {
// Identifier exists, so don't include it in the path // Identifier exists, so don't include it in the path
parts.shift() parts.shift()
} }
@ -536,6 +542,11 @@ class NavBar extends connect(store)(LitElement) {
} }
async getQuery(value) { async getQuery(value) {
try {
} catch (error) {
}
let newQuery = value let newQuery = value
if (newQuery.endsWith('/')) { if (newQuery.endsWith('/')) {
newQuery = newQuery.slice(0, -1) newQuery = newQuery.slice(0, -1)
@ -554,6 +565,7 @@ class NavBar extends connect(store)(LitElement) {
query = query + `&path=${path}` query = query + `&path=${path}`
} }
if (service === "APP") {
this.changePage({ this.changePage({
"url": "qapp", "url": "qapp",
"domain": "core", "domain": "core",
@ -564,17 +576,39 @@ class NavBar extends connect(store)(LitElement) {
"menus": [], "menus": [],
"parent": false "parent": false
}) })
} else if (service === "WEBSITE") {
this.changePage({
"url": "websites",
"domain": "core",
"page": `qdn/browser/index.html${query}`,
"title": "Website",
"icon": "vaadin:desktop",
"mwcicon": "desktop_mac",
"menus": [],
"parent": false
})
}
} }
async handlePasteLink(e) { async handlePasteLink(e) {
try {
const value = this.shadowRoot.getElementById('linkInput').value const value = this.shadowRoot.getElementById('linkInput').value
this.getQuery(value) this.getQuery(value)
} catch (error) {
}
} }
async _handleKeyDown(e) { async _handleKeyDown(e) {
if (e.key === 'Enter') { if (e.key === 'Enter') {
try {
const value = this.shadowRoot.getElementById('linkInput').value const value = this.shadowRoot.getElementById('linkInput').value
this.getQuery(value) this.getQuery(value)
} catch (error) {
}
} }
} }