Skip to content

Commit 3fcc0c4

Browse files
fix eslint errors
1 parent 136d9ae commit 3fcc0c4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/routes/$whimId.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ function WhimDisplay({ whimId, otp }: WhimDisplayProps) {
263263
{" "}
264264
{isDeletionSuccess && data?.deleted
265265
? "Now destroyed"
266-
: hasRemainingAttempts && data
266+
: hasRemainingAttempts
267267
? `${data.remainingAttempts} access${data.remainingAttempts > 1 ? "es" : ""} remaining`
268268
: "Deletion failed, try again"}
269269
</CardDescription>
@@ -315,10 +315,8 @@ function WhimDisplay({ whimId, otp }: WhimDisplayProps) {
315315
{isDeletionSuccess && data?.deleted
316316
? "This secret has been permanently deleted from our servers and cannot be recovered. The encryption keys have been destroyed, ensuring complete privacy and security. If you need to share another secret, create a new whim."
317317
: hasRemainingAttempts
318-
? `This secret can still be accessed ${data?.remainingAttempts} more time${
319-
data?.remainingAttempts && data.remainingAttempts > 1
320-
? "s"
321-
: ""
318+
? `This secret can still be accessed ${data.remainingAttempts} more time${
319+
data.remainingAttempts > 1 ? "s" : ""
322320
} using the same OTP. It will be automatically destroyed after all attempts are used.`
323321
: "The secret was decrypted but the deletion may have failed. Refresh the page to try again."}
324322
</p>

src/server/record-successful-access.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { createServerFn } from "@tanstack/react-start";
22
import { z } from "zod";
3+
import { eq, getTableColumns, sql } from "drizzle-orm";
34
import { db } from "~/lib/db";
45
import { attempts, stats, whims } from "~/lib/db/schema";
5-
import { eq, getTableColumns, sql } from "drizzle-orm";
66

77
const recordSuccessfulAccessSchema = z.object({
88
id: z.string(),
@@ -13,7 +13,7 @@ export const recordSuccessfulAccess = createServerFn({ method: "POST" })
1313
.handler(async ({ data: { id } }) => {
1414
return await db.transaction(
1515
async tx => {
16-
const [result] = await tx
16+
const results = await tx
1717
.select({
1818
whim: getTableColumns(whims),
1919
attempt: getTableColumns(attempts),
@@ -23,6 +23,8 @@ export const recordSuccessfulAccess = createServerFn({ method: "POST" })
2323
.where(eq(whims.id, id))
2424
.limit(1);
2525

26+
const result = results[0] as (typeof results)[0] | undefined;
27+
2628
if (!result) {
2729
throw new Error("Whim does not exist");
2830
}

0 commit comments

Comments
 (0)