Skip to content

Commit f6cc199

Browse files
committed
clean up
1 parent 1672930 commit f6cc199

File tree

6 files changed

+20
-25
lines changed

6 files changed

+20
-25
lines changed

main.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,3 @@ import { start } from "/Users/crowlkats/projects/fresh/server.ts";
88
import routes from "./routes.gen.ts";
99

1010
await start(routes);
11-
12-
/*
13-
paths left to do:
14-
15-
"/api/alias/request": request,
16-
"/api/alias/release": release,
17-
"/api/alias/requests": requests,
18-
*/

pages/alias.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Block } from "../components/block.tsx";
66
import { TextButton } from "../components/text_button.tsx";
77
import { ResultButton } from "../components/result_button.tsx";
88

9-
export function Alias() {
9+
export default function Alias() {
1010
return (
1111
<Layout
1212
script="

pages/api/alias/approve.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ export const handler = {
1515
return couldNotAuthenticate();
1616
}
1717

18-
const { $metadata: { httpStatusCode } } = await approveRequest(
19-
owner,
20-
alias,
21-
);
22-
if (httpStatusCode !== Status.OK) {
18+
try {
19+
await approveRequest(
20+
owner,
21+
alias,
22+
);
23+
} catch (_) {
2324
return error("Alias approval failed", Status.BadRequest);
2425
}
2526

pages/api/alias/deny.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ export const handler = {
1515
return couldNotAuthenticate();
1616
}
1717

18-
const { $metadata: { httpStatusCode } } = await denyRequest(owner, alias);
19-
if (httpStatusCode !== Status.OK) {
18+
try {
19+
await denyRequest(owner, alias);
20+
} catch (_) {
2021
return error("Alias denial failed", Status.BadRequest);
2122
}
2223

pages/api/alias/release.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export const handler = {
5252

5353
item.tags[tag] = script;
5454

55-
const { $metadata: { httpStatusCode } } = await putAlias(item);
56-
57-
if (httpStatusCode !== Status.OK) {
55+
try {
56+
await putAlias(item);
57+
} catch (_) {
5858
return error("Release failed", Status.BadRequest);
5959
}
6060

pages/api/alias/request.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ export const handler = {
2727
return error("Alias already exists", Status.BadRequest);
2828
}
2929

30-
const { $metadata: { httpStatusCode } } = await pushRequest({
31-
alias,
32-
owner: user,
33-
tags: {},
34-
});
35-
if (httpStatusCode !== Status.OK) {
30+
try {
31+
await pushRequest({
32+
alias,
33+
owner: user,
34+
tags: {},
35+
});
36+
} catch (_) {
3637
return error("Alias request failed", Status.BadRequest);
3738
}
3839

0 commit comments

Comments
 (0)