mirror of https://github.com/zulip/zulip.git
billing helpers: Fix implicit use of any.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
d1e2fefad2
commit
fbfdc19cc0
|
@ -97,17 +97,18 @@ export function create_ajax_request(
|
||||||
},
|
},
|
||||||
error(xhr) {
|
error(xhr) {
|
||||||
$(form_loading).hide();
|
$(form_loading).hide();
|
||||||
if (xhr.responseJSON?.msg) {
|
const parsed = z.object({msg: z.string()}).safeParse(xhr.responseJSON);
|
||||||
$(form_error).show().text(xhr.responseJSON.msg);
|
if (parsed.success) {
|
||||||
|
$(form_error).show().text(parsed.data.msg);
|
||||||
}
|
}
|
||||||
$(form_input_section).show();
|
$(form_input_section).show();
|
||||||
error_callback(xhr);
|
error_callback(xhr);
|
||||||
|
|
||||||
if (xhr.status === 401) {
|
if (xhr.status === 401) {
|
||||||
// User session timed out, we need to login again.
|
// User session timed out, we need to login again.
|
||||||
const login_url = JSON.parse(xhr.responseText)?.login_url;
|
const parsed = z.object({login_url: z.string()}).safeParse(xhr.responseJSON);
|
||||||
if (login_url !== undefined) {
|
if (parsed.success) {
|
||||||
window.location.href = login_url;
|
window.location.href = parsed.data.login_url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue