Search接口

main
karlis 2023-07-07 01:22:06 +08:00
parent 9817746fb4
commit 3a79d7b0d2
1 changed files with 21 additions and 1 deletions

View File

@ -6,6 +6,7 @@ QtObject {
id: request
property string baseUrl: "https://api.hammer-hfut.tk:233/aics/main/"
property string searchUrl: "https://api.hammer-hfut.tk:233/aics/query"
//property string baseUrl: "http://192.168.156.74:8080/"
// GET
@ -17,7 +18,26 @@ QtObject {
}
xhr.send()
}
// GET in searchUrl
function getSearch(url, success, failure) {
var xhr = new XMLHttpRequest
xhr.open("GET", searchUrl + url)
xhr.onreadystatechange = function () {
handleResponse(xhr, success, failure)
}
xhr.send()
}
// PUT in searchUrl
function putSearch(url, arg, success, failure) {
var xhr = new XMLHttpRequest
xhr.open("PUT", searchUrl + url)
xhr.setRequestHeader('Content-Type', 'application/json')
xhr.withCredentials = true
xhr.onreadystatechange = function () {
handleResponse(xhr, success, failure)
}
xhr.send(arg)
}
function getAwait(url) {
var xhr = new XMLHttpRequest
xhr.open("GET", baseUrl + url, false)