Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
Fixed report
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschwinghammer committed Jun 12, 2024
1 parent 36fd5b5 commit 0892183
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/main/web/src/organisms/comment/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export const Comment: React.FC<CommentProps> = (props: CommentProps) => {
};

const handleReportSubmit = (reason: string, description: string): void => {
sendReportToBackend(reason, description, id, accountId, "post");
console.log(type);
sendReportToBackend(reason, description, id, accountId, type, commentId);
setReportOpen(!reportOpen);
};

Expand All @@ -56,7 +57,6 @@ export const Comment: React.FC<CommentProps> = (props: CommentProps) => {
};

const [likes, setLikes] = useState(likeAmount);

const [userLiked, setUserLiked] = useState(localStorage.getItem(`${type}_liked_${id}`) === 'true');
const [heartClass, setHeartClass] = useState(userLiked ? 'heart-filled' : 'heart-empty');

Expand Down
2 changes: 1 addition & 1 deletion src/main/web/src/organisms/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const Login: React.FC<Props> = () => {
const handleGoogleLogin = (credentialResponse: CredentialResponse): void => {
googleLogin(JSON.stringify({ token: credentialResponse.credential })).then(
(): void => {
localStorage.setItem('oathUser', 'true');
localStorage.setItem('oAuthUser', 'true');
window.location.reload();
},
(): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/main/web/src/organisms/signup/EmailInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const EmailInput = forwardRef<HTMLDivElement, { onSuccess: () => void }>(
console.log(credentialResponse);
googleLogin(JSON.stringify({ token: credentialResponse.credential })).then(
(): void => {
localStorage.setItem('oathUser', 'true');
localStorage.setItem('oAuthUser', 'true');
navigate("/profile");
window.location.reload();
},
Expand Down
4 changes: 2 additions & 2 deletions src/main/web/src/services/AuthService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const login = async (username: string, password: string, rememberMe: bool
rememberMe
});
saveUserDataToLocalStorage(response.data);
localStorage.setItem('oathUser', 'false');
localStorage.setItem('oAuthUser', 'false');

return response.data;
};
Expand Down Expand Up @@ -64,7 +64,7 @@ export const logout = (): void => {
localStorage.removeItem("username");
localStorage.removeItem("token");
localStorage.removeItem('userImage');
localStorage.removeItem('oathUser');
localStorage.removeItem('oAuthUser');

Object.keys(localStorage)
.filter(x =>
Expand Down
4 changes: 3 additions & 1 deletion src/main/web/src/services/ReportService.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import config from "../config/config";
import {getJWT, getUserId} from "./AuthService";

export const sendReportToBackend = (reportReason: string, reportDescription: string, postId: number, authorId: number | null, type: string): void => {
export const sendReportToBackend = (reportReason: string, reportDescription: string, postId: number, authorId: number | null, type: string,
commentId?: number | null, ): void => {
const jwt: string | null = getJWT();
const headersWithJwt = {
...config.headers,
Expand All @@ -15,6 +16,7 @@ export const sendReportToBackend = (reportReason: string, reportDescription: str
postId: postId,
authorId: authorId,
userId: userId,
commentId: commentId,
type: type
};

Expand Down

0 comments on commit 0892183

Please sign in to comment.