Skip to content

Commit 06a8c90

Browse files
committed
chore: naming
1 parent 6e5080a commit 06a8c90

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/index.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,28 @@ const get = (
4242
};
4343

4444
app.post("/create", async (c) => {
45-
const userIdCookie = getCookie(c, "userId");
46-
if (!userIdCookie) return c.json({});
45+
const userId = getCookie(c, "userId");
46+
if (!userId) return c.text("No userId");
4747
const data = await c.req.json<TModel>();
48-
create(userIdCookie, data);
48+
create(userId, data);
4949
return c.json({
50-
user: userIdCookie,
50+
user: userId,
5151
...data,
5252
});
5353
});
5454

5555
app.post("/clear", (c) => {
56-
const userIdCookie = getCookie(c, "userId");
57-
if (!userIdCookie) return c.json({});
58-
clear(userIdCookie);
59-
return c.json({ cookie: userIdCookie });
56+
const userId = getCookie(c, "userId");
57+
if (!userId) return c.text("No userId");
58+
clear(userId);
59+
return c.json({ cookie: userId });
6060
});
6161

6262
app.all("/api/*", async (c) => {
63-
const userIdCookie = getCookie(c, "userId");
64-
if (!userIdCookie) return c.json({});
63+
const userId = getCookie(c, "userId");
64+
if (!userId) return c.text("No userId");
6565
const path = c.req.path.replace("/api", "");
66-
const redisData = await get(userIdCookie, c.req.method, path);
66+
const redisData = await get(userId, c.req.method, path);
6767
if (!redisData) return c.json({});
6868
const { status, data } = JSON.parse(redisData);
6969
c.status = status;

0 commit comments

Comments
 (0)