add option for blank parameter

This commit is contained in:
cranci1 2025-01-01 20:12:26 +01:00
parent 9addf8325c
commit 194be8ff2b
2 changed files with 10 additions and 2 deletions

View file

@ -174,7 +174,15 @@ struct SearchResultsView: View {
guard let module = module, !searchText.isEmpty else { return }
let encodedSearchText = searchText.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? searchText
let urlString = "\(module.module[0].search.url)?\(module.module[0].search.parameter)=\(encodedSearchText)"
let parameter = module.module[0].search.parameter
let urlString: String
if parameter == "blank" {
urlString = "\(module.module[0].search.url)\(encodedSearchText)"
} else {
urlString = "\(module.module[0].search.url)?\(parameter)=\(encodedSearchText)"
}
guard let url = URL(string: urlString) else { return }
URLSession.custom.dataTask(with: url) { data, _, error in
@ -215,4 +223,4 @@ struct SearchResultsView: View {
}
}.resume()
}
}
}