Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vakila committed Aug 30, 2024
1 parent dee95bb commit ccc7a45
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 28 deletions.
7 changes: 3 additions & 4 deletions convex/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ auth.addHttpRoutes(http);


http.route({
pathPrefix: '/images/',
pathPrefix: '/',
method: "GET",
handler: httpAction(async (ctx, request) => {

Check failure on line 13 in convex/http.ts

View workflow job for this annotation

GitHub Actions / deploy

'ctx' is declared but its value is never read.
const { url, json } = request
const { body: { storageId } } = await json();
const { body: { storageId } } = await request.json();

console.log(`received request.url ${url}`)
console.log(`received request.url ${request.url}`)
console.log(`received request.body.storageId ${storageId}`)

return new Response(null, {
Expand Down
19 changes: 1 addition & 18 deletions convex/users.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { v } from "convex/values";
import { query, mutation, internalMutation } from "./_generated/server";
import { query, mutation } from "./_generated/server";
import { auth } from "./auth";
import { users } from "./schema";
import { crud } from "convex-helpers/server";
Expand All @@ -20,23 +20,6 @@ export const viewer = query({
}
});

export const optimizeImage = internalMutation({
args: { userId: v.id('users') },
handler: async (ctx, args) => {

const user = await read(ctx, { id: args.userId });
if (!user) return null;

// If this user has an image and is an author, optimize their image
if (user.image && !user.image.endsWith('.webp')) {
const isAuthor = (await authoredPosts(ctx, { userId: user._id })).length;
if (isAuthor) {

}

}
},
});


export const authoredPosts = query({
Expand Down
1 change: 0 additions & 1 deletion src/components/Blog/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { useNavigate, useSearchParams } from "react-router-dom";
import { VersionHistory } from "@/components/Blog/History";
import { Toolbar } from "../Toolbar";
import type { Doc } from "../../../convex/_generated/dataModel";
import { TrashIcon } from "@radix-ui/react-icons";

const versionDefaults = {
postId: '',
Expand Down
10 changes: 5 additions & 5 deletions src/components/Inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ export function ImageField<Schema extends FieldValues>({ form }: CommonProps<Sch
const { setValue } = form;

useEffect(() => {
if (image) {
form.setValue('imageUrl' as FieldPath<Schema>,
if (image?.url) {
setValue('imageUrl' as FieldPath<Schema>,
image.url as FieldValue<Schema>,
{ shouldDirty: true });
}

}, [image, setValue]);
}, [image?.url, setValue]);

const saveAfterUpload = async (uploaded: UploadFileResponse[]) => {
const { name, type, size, response } = uploaded[0];
Expand Down Expand Up @@ -144,7 +144,7 @@ export function ImageField<Schema extends FieldValues>({ form }: CommonProps<Sch
onUploadError={(error: unknown) => {
toast({
title: 'Error uploading image',
description: `Error: ${error}`,
description: `Error: ${error as string}`,
variant: 'destructive'
})
}}
Expand All @@ -154,4 +154,4 @@ export function ImageField<Schema extends FieldValues>({ form }: CommonProps<Sch
</div>

)
};
}

0 comments on commit ccc7a45

Please sign in to comment.