-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
topic/delete cookie and use getIdToken #568
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index.js の CookiesProvider を削除できそうです
threatconnectome/web/src/index.jsx
Line 5 in 2d99a21
import { CookiesProvider } from "react-cookie"; |
またそれを実行すると、 package.json の react-cookie
自体を削除できそうに見えます。問題なさそうなら削除をお願いいたします
@mshim03
|
@mshim03
|
web/src/services/firebaseApi.js
Outdated
@@ -6,7 +6,7 @@ import { | |||
browserSessionPersistence, | |||
} from "firebase/auth"; | |||
|
|||
import { setAuthToken } from "../slices/auth"; | |||
// import { setAuthToken } from "../slices/auth"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コメントアウト行は削除してください
search: location.search, | ||
message: "Please login to continue.", | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tryLogin()して、エラーならloginページにnavigate、
の処理は消してはいけないと思います。
2点修正しました
|
web/src/pages/App/AppPage.jsx
Outdated
@@ -49,7 +35,7 @@ export function App() { | |||
} | |||
}; | |||
_checkToken(); | |||
}, [cookies, dispatch, location, navigate, skip, tryLogin]); | |||
}, [location, navigate, tryLogin]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_checkToken()を定義する必要が無くなった気がします。下記のように書けますでしょうか。
useEffect(async () => {
try {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上記のコードのようにしたところ以下の警告が出ました
Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
_checkToken()を定義したままにします。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
全体的に良いと思います
useEffect の依存配列の修正漏れと、フックについて確認お願いします
web/src/components/PTeamLabel.jsx
Outdated
@@ -16,7 +16,8 @@ export function PTeamLabel(props) { | |||
|
|||
const [pteamSettingsModalOpen, setPTeamSettingsModalOpen] = useState(false); | |||
|
|||
const skip = useSkipUntilAuthTokenIsReady(); | |||
const skip = !useSelector((state) => state.auth.authUserIsReady); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!useSelector((state) => state.auth.authUserIsReady);
がコードの中に散らばってますが、元も useSkipUntilAuthTokenisReady
のように独自フックにロジックを押し込めた方がいいかもしれません
web/src/pages/App/AppPage.jsx
Outdated
_checkToken(); | ||
}, [cookies, dispatch, location, navigate, skip, tryLogin]); | ||
}); | ||
}, [location, dispatch, navigate, tryLogin]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tryLogin
はもう不要ではないでしょうか
@mshim03
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR の目的
経緯・意図・意思決定
auth.currentUser?.getIdToken(true)
への変更auth.currentUser?.getIdToken(true)
から取得したアクセストークンを使用するように変更しました