Skip to content

Commit 4692c37

Browse files
authored
Merge pull request #57 from flatrun/feat/cert-renewal
feat(certificates): Add per-cert renewal and auto-renew controls
2 parents 1e3737b + e548a9d commit 4692c37

3 files changed

Lines changed: 384 additions & 10 deletions

File tree

src/services/api.ts

100644100755
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,25 @@ export const networksApi = {
157157

158158
export const certificatesApi = {
159159
list: () => apiClient.get<{ certificates: Certificate[] }>("/certificates"),
160+
get: (domain: string) => apiClient.get<{ certificate: Certificate }>(`/certificates/${encodeURIComponent(domain)}`),
160161
request: (domain: string) =>
161162
apiClient.post<{ message: string; result: any }>("/certificates", {
162163
domain,
163164
}),
164165
renew: () => apiClient.post<{ message: string; result: any }>("/certificates/renew"),
165-
delete: (domain: string) => apiClient.delete(`/certificates/${domain}`),
166+
renewOne: (domain: string) =>
167+
apiClient.post<{ message: string; domain: string; result: any }>(
168+
`/certificates/${encodeURIComponent(domain)}/renew`,
169+
),
170+
setAutoRenew: (domain: string, autoRenew: boolean) =>
171+
apiClient.patch<{ domain: string; auto_renew: boolean }>(`/certificates/${encodeURIComponent(domain)}/auto-renew`, {
172+
auto_renew: autoRenew,
173+
}),
174+
renewDeployment: (name: string) =>
175+
apiClient.post<{ message: string; deployment: string; result: any }>(
176+
`/deployments/${encodeURIComponent(name)}/certificates/renew`,
177+
),
178+
delete: (domain: string) => apiClient.delete(`/certificates/${encodeURIComponent(domain)}`),
166179
};
167180

168181
export const proxyApi = {

0 commit comments

Comments
 (0)