mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-11-04 17:35:15 +00:00
Certificates react work
- renewal and download - table columns rendering - searching - deleting
This commit is contained in:
@@ -80,8 +80,16 @@ export async function get(args: GetArgs, abortController?: AbortController) {
|
||||
return processResponse(await baseGet(args, abortController));
|
||||
}
|
||||
|
||||
export async function download(args: GetArgs, abortController?: AbortController) {
|
||||
return (await baseGet(args, abortController)).text();
|
||||
export async function download({ url, params }: GetArgs, filename = "download.file") {
|
||||
const headers = buildAuthHeader();
|
||||
const res = await fetch(buildUrl({ url, params }), { headers });
|
||||
const bl = await res.blob();
|
||||
const u = window.URL.createObjectURL(bl);
|
||||
const a = document.createElement("a");
|
||||
a.href = u;
|
||||
a.download = filename;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
interface PostArgs {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import * as api from "./base";
|
||||
import type { Binary } from "./responseTypes";
|
||||
|
||||
export async function downloadCertificate(id: number): Promise<Binary> {
|
||||
return await api.get({
|
||||
url: `/nginx/certificates/${id}/download`,
|
||||
});
|
||||
export async function downloadCertificate(id: number): Promise<void> {
|
||||
await api.download(
|
||||
{
|
||||
url: `/nginx/certificates/${id}/download`,
|
||||
},
|
||||
`certificate-${id}.zip`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,5 +15,3 @@ export interface ValidatedCertificateResponse {
|
||||
certificate: Record<string, any>;
|
||||
certificateKey: boolean;
|
||||
}
|
||||
|
||||
export type Binary = number & { readonly __brand: unique symbol };
|
||||
|
||||
Reference in New Issue
Block a user