client: js: add cache support to text fetches

This commit is contained in:
nym21
2026-04-15 19:19:59 +02:00
parent c23e0f2a3c
commit 75a97b4da9
3 changed files with 78 additions and 56 deletions
@@ -91,7 +91,7 @@ pub fn generate_api_methods(output: &mut String, endpoints: &[Endpoint]) {
let fetch_call = if endpoint.returns_json() {
"this.getJson(path, { signal, onUpdate })"
} else {
"this.getText(path, { signal })"
"this.getText(path, { signal, onUpdate })"
};
if endpoint.query_params.is_empty() {
@@ -126,7 +126,7 @@ pub fn generate_api_methods(output: &mut String, endpoints: &[Endpoint]) {
}
if endpoint.supports_csv {
writeln!(output, " if (format === 'csv') return this.getText(path, {{ signal }});").unwrap();
writeln!(output, " if (format === 'csv') return this.getText(path, {{ signal, onUpdate }});").unwrap();
}
writeln!(output, " return {};", fetch_call).unwrap();