Skip to content

Commit

Permalink
Fix lint errors that won't break
Browse files Browse the repository at this point in the history
  • Loading branch information
dloh2236 committed Nov 9, 2024
1 parent 5de7e8b commit bef34aa
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useState } from "react";
import { Input } from "@nextui-org/input";
import { useRouter, useSearchParams } from "next/navigation";
import { useRouter } from "next/navigation";
import { CircularProgress, Tooltip } from "@nextui-org/react";

import BoxIcon from "@/components/boxicons";
Expand All @@ -22,7 +22,7 @@ export default function ResetPasswordPage() {
const [isLoading, setIsLoading] = useState(false);
const [isFormSubmitted, setIsFormSubmitted] = useState(false);
const [toast, setToast] = useState<{ message: string; type: string } | null>(
null
null,
);

const toggleVisibility = () => setIsVisible(!isVisible);
Expand Down
6 changes: 3 additions & 3 deletions frontend/peerprep/app/@landing/sign-up/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function SignUpPage() {
const [isLoading, setIsLoading] = useState<boolean>(false);
const [isFormSubmitted, setIsFormSubmitted] = useState(false);
const [toast, setToast] = useState<{ message: string; type: string } | null>(
null
null,
);

// Toggle password visibility
Expand Down Expand Up @@ -65,9 +65,9 @@ export default function SignUpPage() {
setTimeout(
() =>
router.push(
`sign-up/email-verification?email=${encodeURIComponent(email)}`
`sign-up/email-verification?email=${encodeURIComponent(email)}`,
),
500
500,
);
} else {
setToast({
Expand Down
37 changes: 31 additions & 6 deletions frontend/peerprep/auth/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,11 @@ export const editUsername = async (newUsername: string) => {
}

try {
const updatedToken = await updateTokenWithField(session.accessToken, "username", secret);
const updatedToken = await updateTokenWithField(
session.accessToken,
"username",
secret,
);
const response = await fetch(
`${USER_SERVICE_URL}/users/${session.userId}`,
{
Expand Down Expand Up @@ -610,7 +614,11 @@ export const verifyEmailCode = async (code: number, newEmail: string) => {
}

if (verificationCode === code) {
const updatedToken = await updateTokenWithField(accessToken, "email", secret);
const updatedToken = await updateTokenWithField(
accessToken,
"email",
secret,
);

// If code matches, update the email
console.log(newEmail);
Expand Down Expand Up @@ -686,7 +694,11 @@ export const changePassword = async (newPassword: string) => {
}

try {
const updatedToken = await updateTokenWithField(session.accessToken, "password", secret);
const updatedToken = await updateTokenWithField(
session.accessToken,
"password",
secret,
);

const response = await fetch(
`${USER_SERVICE_URL}/users/${session.userId}`,
Expand Down Expand Up @@ -746,7 +758,11 @@ export const resetPassword = async (newPassword: string) => {

const userId = payload.id;

const updatedToken = await updateTokenWithField(resetToken, "password", secret);
const updatedToken = await updateTokenWithField(
resetToken,
"password",
secret,
);

const response = await fetch(`${USER_SERVICE_URL}/users/${userId}`, {
method: "PATCH",
Expand All @@ -761,6 +777,7 @@ export const resetPassword = async (newPassword: string) => {

if (response.ok) {
await session.destroy();

return { status: "success", message: "Password updated successfully" };
} else {
const errorData = await response.json();
Expand Down Expand Up @@ -792,7 +809,11 @@ export const deleteUser = async () => {
return { status: "error", message: "Internal application error" };
}

const updatedToken = await updateTokenWithField(session.accessToken, "delete", secret);
const updatedToken = await updateTokenWithField(
session.accessToken,
"delete",
secret,
);

const response = await fetch(`${USER_SERVICE_URL}/users/${session.userId}`, {
method: "DELETE",
Expand Down Expand Up @@ -863,7 +884,11 @@ export const forgetPassword = async (identifier: string) => {
}
};

async function updateTokenWithField(token: string, field: string, secret: string): Promise<string> {
async function updateTokenWithField(
token: string,
field: string,
secret: string,
): Promise<string> {
const secretKey = new TextEncoder().encode(secret);

try {
Expand Down
2 changes: 1 addition & 1 deletion frontend/peerprep/components/greetingmessageheader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const GreetingMessageHeader = ({ user }: GreetingMessageProps) => {
margin: "10px",
}}
>
Mistakes are only mistakes if you don't learn from them 🧑‍💻
Mistakes are only mistakes if you don&apos;t learn from them 🧑‍💻
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import { Card, Skeleton, Spinner } from "@nextui-org/react";
import { useRouter } from "next/navigation";

import { useMatchHistoryFetcher } from "@/services/userService";
import SessionHistoryCard from "@/components/session-history/SessionHistoryCard";
Expand Down Expand Up @@ -43,7 +42,7 @@ interface Match {

const SessionCard = ({ match }: { match: Match }) => {
const { questionData, questionLoading } = useQuestionDataFetcher(
match.questionId
match.questionId,
);

if (questionLoading) {
Expand Down

0 comments on commit bef34aa

Please sign in to comment.