mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-20 16:12:50 +00:00
add option for blank parameter
This commit is contained in:
parent
9addf8325c
commit
194be8ff2b
2 changed files with 10 additions and 2 deletions
Binary file not shown.
|
|
@ -174,7 +174,15 @@ struct SearchResultsView: View {
|
||||||
guard let module = module, !searchText.isEmpty else { return }
|
guard let module = module, !searchText.isEmpty else { return }
|
||||||
|
|
||||||
let encodedSearchText = searchText.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? searchText
|
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 }
|
guard let url = URL(string: urlString) else { return }
|
||||||
|
|
||||||
URLSession.custom.dataTask(with: url) { data, _, error in
|
URLSession.custom.dataTask(with: url) { data, _, error in
|
||||||
|
|
@ -215,4 +223,4 @@ struct SearchResultsView: View {
|
||||||
}
|
}
|
||||||
}.resume()
|
}.resume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue