Skip to content

Commit

Permalink
fixup! App CheckのtokenをAPI使用時に取得するように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
MurakawaTakuya committed Jan 28, 2025
1 parent 05647d4 commit ce9eafb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 17 additions & 1 deletion src/Components/DashBoard/DashBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { useResults } from "@/utils/ResultContext";
import { useUser } from "@/utils/UserContext";
import Typography from "@mui/joy/Typography";
import LinearProgress from "@mui/material/LinearProgress";
import console from "console";
import { useEffect, useRef, useState } from "react";
import CenterIn from "../Animation/CenterIn";
import Progress from "../Progress/Progress";
import styles from "./DashBoard.module.scss";

export default function DashBoard({
userId = "",
success = true,
Expand Down Expand Up @@ -77,6 +77,19 @@ export default function DashBoard({
limit,
})
.then((data) => {
console.log("data", data);
if (
!data ||
!data.successResults ||
!data.failedResults ||
!data.pendingResults
) {
showSnackBar({
message: "データの取得に失敗しました。ログインし直してください。",
type: "warning",
});
return;
}
// 既に追加されている場合は追加しない
setSuccessResults((prev) => {
const newResults = data.successResults.filter(
Expand Down Expand Up @@ -213,6 +226,9 @@ export default function DashBoard({
limit: 1,
})
.then((data) => {
if (!data.successResults) {
return;
}
if (data.successResults.length > 0) {
setLastPostDate(data.successResults[0].post?.submittedAt);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Progress/Progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function Progress({
return (
<SuccessStep
key={result.goalId}
result={result as GoalWithIdAndUserData}
result={result}
user={user as User}
isBlured={
result.post?.submittedAt && lastPostDate
Expand All @@ -64,15 +64,15 @@ export default function Progress({
return (
<FailedStep
key={result.goalId}
result={result as GoalWithIdAndUserData}
result={result}
user={user as User}
/>
);
} else if (result.type === "pending") {
return (
<PendingStep
key={result.goalId}
result={result as GoalWithIdAndUserData}
result={result}
user={user as User}
/>
);
Expand Down

0 comments on commit ce9eafb

Please sign in to comment.