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) {
|
||||
$(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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue