Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

billing helpers: Fix implicit use of any.

Anders Kaseorgfbfdc19cc03f
diff --git a/web/src/billing/helpers.ts b/web/src/billing/helpers.ts
index 2d975e9e36f..863acd5dae6 100644
--- a/web/src/billing/helpers.ts
+++ b/web/src/billing/helpers.ts
@@ -97,17 +97,18 @@ export function create_ajax_request(
},
error(xhr) {
$(form_loading).hide();
- if (xhr.responseJSON?.msg) {
- $(form_error).show().text(xhr.responseJSON.msg);
+ const parsed = z.object({msg: z.string()}).safeParse(xhr.responseJSON);
+ if (parsed.success) {
+ $(form_error).show().text(parsed.data.msg);
}
$(form_input_section).show();
error_callback(xhr);
if (xhr.status === 401) {
// User session timed out, we need to login again.
- const login_url = JSON.parse(xhr.responseText)?.login_url;
- if (login_url !== undefined) {
- window.location.href = login_url;
+ const parsed = z.object({login_url: z.string()}).safeParse(xhr.responseJSON);
+ if (parsed.success) {
+ window.location.href = parsed.data.login_url;
}
}
},