fix(api): fix api endpoint logic #3

This commit is contained in:
shafin-r
2025-08-17 14:08:17 +06:00
parent ad46bf954e
commit 4f23f357e6
7 changed files with 87 additions and 69 deletions

View File

@ -144,8 +144,7 @@ const HomePage = () => {
{/* Leaderboard Section */}
<div className={styles.leaderboardWrapper}>
<h2 className={styles.sectionTitle}>Leaderboard</h2>
<p className="text-center text-xl">Coming Soon.</p>
{/* <div className={styles.leaderboardContainer}>
<div className={styles.leaderboardContainer}>
<div className={styles.topThreeHeader}>
<span className={styles.topThreeTitle}>Top 3</span>
<button
@ -157,7 +156,7 @@ const HomePage = () => {
</div>
<div className={styles.divider}></div>
<div className={styles.topThreeList}>
{boardError ? (
{/* {boardError ? (
<DestructibleAlert text={boardError} />
) : (
getTopThree(boardData).map((student, idx) => (
@ -174,9 +173,10 @@ const HomePage = () => {
</span>
</div>
))
)}
)} */}
<h2 className="text-center text-xl">Coming soon</h2>
</div>
</div> */}
</div>
</div>
{/* Performance Summary Section */}

View File

@ -20,7 +20,7 @@ const ProfilePage = () => {
const token = await getToken();
if (!token) return;
const response = await fetch(`${API_URL}/me`, {
const response = await fetch(`${API_URL}/me/profile/`, {
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
@ -79,7 +79,9 @@ const ProfilePage = () => {
<div className="relative mx-10">
<Avatar className="bg-[#113768] w-32 h-32 absolute -top-20 left-1/2 transform -translate-x-1/2">
<AvatarFallback className="text-3xl text-white">
{userData?.name ? userData.name.charAt(0).toUpperCase() : ""}
{userData?.username
? userData.username.charAt(0).toUpperCase()
: ""}
</AvatarFallback>
</Avatar>

View File

@ -24,12 +24,18 @@ import React, { useEffect, useState } from "react";
const SettingsPage = () => {
const router = useRouter();
const [userData, setUserData] = useState<UserData>({
name: "",
institution: "",
sscRoll: "",
hscRoll: "",
user_id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
username: "",
full_name: "",
email: "",
phone: "",
is_verified: false,
phone_number: "",
ssc_roll: 0,
ssc_board: "",
hsc_roll: 0,
hsc_board: "",
college: "",
preparation_unit: "Science",
});
useEffect(() => {
@ -38,7 +44,7 @@ const SettingsPage = () => {
const token = await getToken();
if (!token) return;
const response = await fetch(`${API_URL}/me`, {
const response = await fetch(`${API_URL}/me/`, {
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
@ -75,13 +81,15 @@ const SettingsPage = () => {
<div className="flex gap-4 items-center">
<Avatar className="bg-[#113768] w-20 h-20">
<AvatarFallback className="text-3xl text-white">
{userData?.name
? userData.name.charAt(0).toUpperCase()
{userData?.username
? userData.username.charAt(0).toUpperCase()
: ""}
</AvatarFallback>
</Avatar>
<div className="flex flex-col items-start">
<h1 className="font-semibold text-2xl">{userData?.name}</h1>
<h1 className="font-semibold text-2xl">
{userData?.full_name}
</h1>
<h3 className=" text-md">{userData?.email}</h3>
</div>
</div>