Skip to content

Commit 54e0362

Browse files
committed
API lib cleanup, 404 hosts WIP
1 parent 058f49c commit 54e0362

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+921
-544
lines changed
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import * as api from "./base";
22
import type { AccessList } from "./models";
33

4-
export async function createAccessList(item: AccessList, abortController?: AbortController): Promise<AccessList> {
5-
return await api.post(
6-
{
7-
url: "/nginx/access-lists",
8-
// todo: only use whitelist of fields for this data
9-
data: item,
10-
},
11-
abortController,
12-
);
4+
export async function createAccessList(item: AccessList): Promise<AccessList> {
5+
return await api.post({
6+
url: "/nginx/access-lists",
7+
// todo: only use whitelist of fields for this data
8+
data: item,
9+
});
1310
}
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import * as api from "./base";
22
import type { Certificate } from "./models";
33

4-
export async function createCertificate(item: Certificate, abortController?: AbortController): Promise<Certificate> {
5-
return await api.post(
6-
{
7-
url: "/nginx/certificates",
8-
// todo: only use whitelist of fields for this data
9-
data: item,
10-
},
11-
abortController,
12-
);
4+
export async function createCertificate(item: Certificate): Promise<Certificate> {
5+
return await api.post({
6+
url: "/nginx/certificates",
7+
// todo: only use whitelist of fields for this data
8+
data: item,
9+
});
1310
}
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import * as api from "./base";
22
import type { DeadHost } from "./models";
33

4-
export async function createDeadHost(item: DeadHost, abortController?: AbortController): Promise<DeadHost> {
5-
return await api.post(
6-
{
7-
url: "/nginx/dead-hosts",
8-
// todo: only use whitelist of fields for this data
9-
data: item,
10-
},
11-
abortController,
12-
);
4+
export async function createDeadHost(item: DeadHost): Promise<DeadHost> {
5+
return await api.post({
6+
url: "/nginx/dead-hosts",
7+
// todo: only use whitelist of fields for this data
8+
data: item,
9+
});
1310
}
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import * as api from "./base";
22
import type { ProxyHost } from "./models";
33

4-
export async function createProxyHost(item: ProxyHost, abortController?: AbortController): Promise<ProxyHost> {
5-
return await api.post(
6-
{
7-
url: "/nginx/proxy-hosts",
8-
// todo: only use whitelist of fields for this data
9-
data: item,
10-
},
11-
abortController,
12-
);
4+
export async function createProxyHost(item: ProxyHost): Promise<ProxyHost> {
5+
return await api.post({
6+
url: "/nginx/proxy-hosts",
7+
// todo: only use whitelist of fields for this data
8+
data: item,
9+
});
1310
}
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
import * as api from "./base";
22
import type { RedirectionHost } from "./models";
33

4-
export async function createRedirectionHost(
5-
item: RedirectionHost,
6-
abortController?: AbortController,
7-
): Promise<RedirectionHost> {
8-
return await api.post(
9-
{
10-
url: "/nginx/redirection-hosts",
11-
// todo: only use whitelist of fields for this data
12-
data: item,
13-
},
14-
abortController,
15-
);
4+
export async function createRedirectionHost(item: RedirectionHost): Promise<RedirectionHost> {
5+
return await api.post({
6+
url: "/nginx/redirection-hosts",
7+
// todo: only use whitelist of fields for this data
8+
data: item,
9+
});
1610
}
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import * as api from "./base";
22
import type { Stream } from "./models";
33

4-
export async function createStream(item: Stream, abortController?: AbortController): Promise<Stream> {
5-
return await api.post(
6-
{
7-
url: "/nginx/streams",
8-
// todo: only use whitelist of fields for this data
9-
data: item,
10-
},
11-
abortController,
12-
);
4+
export async function createStream(item: Stream): Promise<Stream> {
5+
return await api.post({
6+
url: "/nginx/streams",
7+
// todo: only use whitelist of fields for this data
8+
data: item,
9+
});
1310
}

frontend/src/api/backend/createUser.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ export interface NewUser {
1515
roles?: string[];
1616
}
1717

18-
export async function createUser(item: NewUser, noAuth?: boolean, abortController?: AbortController): Promise<User> {
19-
return await api.post(
20-
{
21-
url: "/users",
22-
// todo: only use whitelist of fields for this data
23-
data: item,
24-
noAuth,
25-
},
26-
abortController,
27-
);
18+
export async function createUser(item: NewUser, noAuth?: boolean): Promise<User> {
19+
return await api.post({
20+
url: "/users",
21+
// todo: only use whitelist of fields for this data
22+
data: item,
23+
noAuth,
24+
});
2825
}
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import * as api from "./base";
22

3-
export async function deleteAccessList(id: number, abortController?: AbortController): Promise<boolean> {
4-
return await api.del(
5-
{
6-
url: `/nginx/access-lists/${id}`,
7-
},
8-
abortController,
9-
);
3+
export async function deleteAccessList(id: number): Promise<boolean> {
4+
return await api.del({
5+
url: `/nginx/access-lists/${id}`,
6+
});
107
}
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import * as api from "./base";
22

3-
export async function deleteCertificate(id: number, abortController?: AbortController): Promise<boolean> {
4-
return await api.del(
5-
{
6-
url: `/nginx/certificates/${id}`,
7-
},
8-
abortController,
9-
);
3+
export async function deleteCertificate(id: number): Promise<boolean> {
4+
return await api.del({
5+
url: `/nginx/certificates/${id}`,
6+
});
107
}
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import * as api from "./base";
22

3-
export async function deleteDeadHost(id: number, abortController?: AbortController): Promise<boolean> {
4-
return await api.del(
5-
{
6-
url: `/nginx/dead-hosts/${id}`,
7-
},
8-
abortController,
9-
);
3+
export async function deleteDeadHost(id: number): Promise<boolean> {
4+
return await api.del({
5+
url: `/nginx/dead-hosts/${id}`,
6+
});
107
}

0 commit comments

Comments
 (0)