fix: duplication error
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -19,7 +19,7 @@ app.config.timestamp_*.js
|
|||||||
.classpath
|
.classpath
|
||||||
*.launch
|
*.launch
|
||||||
.settings/
|
.settings/
|
||||||
#tasks
|
tasks
|
||||||
|
|
||||||
# Temp
|
# Temp
|
||||||
gitignore
|
gitignore
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ export interface PostLike {
|
|||||||
post_id: string;
|
post_id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SessionDependantLikeProps {
|
export interface AuthenticatedLikeProps {
|
||||||
currentUserID: string | undefined | null;
|
currentUserID: string | undefined | null;
|
||||||
isAuthenticated: boolean;
|
isAuthenticated: boolean;
|
||||||
likes: PostLike[];
|
likes: PostLike[];
|
||||||
projectID: number;
|
projectID: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SessionDependantLike(props: SessionDependantLikeProps) {
|
export default function AuthenticatedLike(props: AuthenticatedLikeProps) {
|
||||||
const [hovering, setHovering] = createSignal(false);
|
const [hovering, setHovering] = createSignal(false);
|
||||||
const [likes, setLikes] = createSignal(props.likes);
|
const [likes, setLikes] = createSignal(props.likes);
|
||||||
const [instantOffset, setInstantOffset] = createSignal(0);
|
const [instantOffset, setInstantOffset] = createSignal(0);
|
||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
import { PageHead } from "~/components/PageHead";
|
import { PageHead } from "~/components/PageHead";
|
||||||
import { createAsync } from "@solidjs/router";
|
import { createAsync } from "@solidjs/router";
|
||||||
import { getRequestEvent } from "solid-js/web";
|
import { getRequestEvent } from "solid-js/web";
|
||||||
import SessionDependantLike from "~/components/blog/SessionDependantLike";
|
import AuthenticatedLike from "~/components/blog/AuthenticatedLike";
|
||||||
import CommentIcon from "~/components/icons/CommentIcon";
|
import CommentIcon from "~/components/icons/CommentIcon";
|
||||||
import { Fire } from "~/components/icons/Fire";
|
import { Fire } from "~/components/icons/Fire";
|
||||||
import CommentSectionWrapper from "~/components/blog/CommentSectionWrapper";
|
import CommentSectionWrapper from "~/components/blog/CommentSectionWrapper";
|
||||||
@@ -433,11 +433,11 @@ export default function PostPage() {
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<SessionDependantLike
|
<AuthenticatedLike
|
||||||
currentUserID={postData.userID}
|
currentUserID={userID}
|
||||||
isAuthenticated={postData.isAuthenticated}
|
isAuthenticated={isAuthenticated}
|
||||||
likes={postData.likes as any[]}
|
likes={post.likes}
|
||||||
projectID={p().id}
|
projectID={post.id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ const routerSections: RouterSection[] = [
|
|||||||
router: "auth",
|
router: "auth",
|
||||||
procedure: "signOut",
|
procedure: "signOut",
|
||||||
method: "mutation",
|
method: "mutation",
|
||||||
description: "Clear auth cookies and sign out"
|
description: "Clear auth cookie and sign out"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "GitHub Callback",
|
name: "GitHub Callback",
|
||||||
|
|||||||
@@ -1188,7 +1188,7 @@ export const authRouter = createTRPCRouter({
|
|||||||
const secret = new TextEncoder().encode(env.JWT_SECRET_KEY);
|
const secret = new TextEncoder().encode(env.JWT_SECRET_KEY);
|
||||||
const token = await new SignJWT({
|
const token = await new SignJWT({
|
||||||
email,
|
email,
|
||||||
rememberMe: rememberMe ?? false, // Default to browser session cookie
|
rememberMe: rememberMe ?? false, // Default to browser cookie
|
||||||
code: loginCode
|
code: loginCode
|
||||||
})
|
})
|
||||||
.setProtectedHeader({ alg: "HS256" })
|
.setProtectedHeader({ alg: "HS256" })
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { jwtVerify } from "jose";
|
|
||||||
import { SignJWT, jwtVerify } from "jose";
|
import { SignJWT, jwtVerify } from "jose";
|
||||||
import { env } from "~/env/server";
|
import { env } from "~/env/server";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user