Skip to content

Commit

Permalink
fix lint & frontend build
Browse files Browse the repository at this point in the history
  • Loading branch information
alishakawaguchi committed Sep 1, 2023
1 parent 752587d commit a9bd080
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion backend/internal/dtomaps/connections.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func ToConnectionDto(
Name: input.Name,
ConnectionConfig: connectionConfig,
CreatedAt: timestamppb.New(input.CreationTimestamp.Time),
UpdatedAt: timestamppb.New(input.CreationTimestamp.Time), // TODO
UpdatedAt: timestamppb.New(input.CreationTimestamp.Time), // TODO @alisha
}, nil
}

Expand Down
5 changes: 1 addition & 4 deletions frontend/app/api/connections/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import { NextRequest, NextResponse } from 'next/server';

export async function GET(req: NextRequest): Promise<NextResponse> {
return withNeosyncContext(async (ctx) => {
return ctx.connectionClient.getConnections(
new GetConnectionsRequest({
})
);
return ctx.connectionClient.getConnections(new GetConnectionsRequest({}));
})(req);
}

Expand Down
12 changes: 2 additions & 10 deletions frontend/app/new/connection/postgres/PostgresForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use client';
import { useAccount } from '@/components/contexts/account-context';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
import {
Expand Down Expand Up @@ -56,20 +55,15 @@ export default function PostgresForm() {
},
});
const router = useRouter();
const account = useAccount();
const [checkResp, setCheckResp] = useState<
CheckConnectionConfigResponse | undefined
>();

async function onSubmit(values: FormValues) {
if (!account?.id) {
return;
}
try {
const connection = await createPostgresConnection(
values.db,
values.connectionName,
account.id
values.connectionName
);
if (connection.connection?.id) {
router.push(`/connections/${connection.connection.id}`);
Expand Down Expand Up @@ -255,8 +249,7 @@ function ErrorAlert(props: ErrorAlertProps): ReactElement {
}
async function createPostgresConnection(
db: FormValues['db'],
name: string,
accountId: string
name: string
): Promise<CreateConnectionResponse> {
const res = await fetch(`/api/connections`, {
method: 'POST',
Expand All @@ -265,7 +258,6 @@ async function createPostgresConnection(
},
body: JSON.stringify(
new CreateConnectionRequest({
accountId: accountId,
name: name,
connectionConfig: new ConnectionConfig({
config: {
Expand Down
12 changes: 4 additions & 8 deletions frontend/libs/hooks/useGetConnections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ export function useGetConnections(): HookReply<GetConnectionsResponse> {
return useNucleusAuthenticatedFetch<
GetConnectionsResponse,
JsonValue | GetConnectionsResponse
>(
`/api/connections`,
undefined,
undefined,
(data) =>
data instanceof GetConnectionsResponse
? data
: GetConnectionsResponse.fromJson(data)
>(`/api/connections`, undefined, undefined, (data) =>
data instanceof GetConnectionsResponse
? data
: GetConnectionsResponse.fromJson(data)
);
}

0 comments on commit a9bd080

Please sign in to comment.