Fix ESLint issues
This commit is contained in:
parent
92ce2e68ad
commit
03f57a0ad7
@ -66,23 +66,25 @@ export class APIClient {
|
|||||||
if (args.upProgress) {
|
if (args.upProgress) {
|
||||||
const res: XMLHttpRequest = await new Promise((resolve, reject) => {
|
const res: XMLHttpRequest = await new Promise((resolve, reject) => {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.upload.addEventListener("progress", (e) =>
|
xhr.upload.addEventListener("progress", (e) => {
|
||||||
{ args.upProgress!(e.loaded / e.total); }
|
args.upProgress!(e.loaded / e.total);
|
||||||
);
|
});
|
||||||
xhr.addEventListener("load", () => { resolve(xhr); });
|
xhr.addEventListener("load", () => {
|
||||||
xhr.addEventListener("error", () =>
|
resolve(xhr);
|
||||||
{ reject(new Error("File upload failed")); }
|
});
|
||||||
);
|
xhr.addEventListener("error", () => {
|
||||||
xhr.addEventListener("abort", () =>
|
reject(new Error("File upload failed"));
|
||||||
{ reject(new Error("File upload aborted")); }
|
});
|
||||||
);
|
xhr.addEventListener("abort", () => {
|
||||||
xhr.addEventListener("timeout", () =>
|
reject(new Error("File upload aborted"));
|
||||||
{ reject(new Error("File upload timeout")); }
|
});
|
||||||
);
|
xhr.addEventListener("timeout", () => {
|
||||||
|
reject(new Error("File upload timeout"));
|
||||||
|
});
|
||||||
xhr.open(args.method, url, true);
|
xhr.open(args.method, url, true);
|
||||||
xhr.withCredentials = true;
|
xhr.withCredentials = true;
|
||||||
for (const key in headers) {
|
for (const key in headers) {
|
||||||
if (headers.hasOwnProperty(key))
|
if (Object.prototype.hasOwnProperty.call(headers, key))
|
||||||
xhr.setRequestHeader(key, headers[key]);
|
xhr.setRequestHeader(key, headers[key]);
|
||||||
}
|
}
|
||||||
xhr.send(body);
|
xhr.send(body);
|
||||||
|
@ -26,7 +26,7 @@ export function CreateTokenDialog(p: {
|
|||||||
const loadingMessage = useLoadingMessage();
|
const loadingMessage = useLoadingMessage();
|
||||||
|
|
||||||
const [newTokenUndef, setNewToken] = React.useState<NewToken | undefined>();
|
const [newTokenUndef, setNewToken] = React.useState<NewToken | undefined>();
|
||||||
const newToken = newTokenUndef || {
|
const newToken = newTokenUndef ?? {
|
||||||
name: "",
|
name: "",
|
||||||
ip_net: undefined,
|
ip_net: undefined,
|
||||||
max_inactivity: 3600 * 24 * 90,
|
max_inactivity: 3600 * 24 * 90,
|
||||||
|
@ -200,6 +200,7 @@ function TokensRouteInner(p: {
|
|||||||
getActions: ({ id }) => {
|
getActions: ({ id }) => {
|
||||||
return [
|
return [
|
||||||
<GridActionsCellItem
|
<GridActionsCellItem
|
||||||
|
key={id}
|
||||||
icon={<DeleteIcon />}
|
icon={<DeleteIcon />}
|
||||||
label="Delete"
|
label="Delete"
|
||||||
onClick={handleDeleteClick(id)}
|
onClick={handleDeleteClick(id)}
|
||||||
|
@ -26,7 +26,7 @@ export function checkConstraint(
|
|||||||
export function checkURL(s: string): boolean {
|
export function checkURL(s: string): boolean {
|
||||||
try {
|
try {
|
||||||
return Boolean(new URL(s));
|
return Boolean(new URL(s));
|
||||||
} catch (e) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ export function AsyncWidget(p: {
|
|||||||
}): React.ReactElement {
|
}): React.ReactElement {
|
||||||
const [state, setState] = useState(State.Loading);
|
const [state, setState] = useState(State.Loading);
|
||||||
|
|
||||||
const counter = useRef<any | null>(null);
|
const counter = useRef<any>(null);
|
||||||
|
|
||||||
const load = async () => {
|
const load = async () => {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user