refactor: useSelector

This commit is contained in:
Tristan Yang
2023-08-29 11:33:23 +08:00
parent 647bae7116
commit fe10a1c374
116 changed files with 572 additions and 661 deletions
@@ -1,7 +1,7 @@
import { FC, useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { shallowEqual, useDispatch } from "react-redux";
import { useWizard } from "react-use-wizard";
import { useLoginMutation } from "@/app/services/auth";
@@ -18,7 +18,7 @@ const AdminAccount: FC<Props> = ({ serverName }) => {
const { t } = useTranslation("welcome", { keyPrefix: "onboarding" });
const { nextStep } = useWizard();
const formRef = useRef<HTMLFormElement | undefined>();
const loggedIn = useAppSelector((store) => !!store.authData.token);
const loggedIn = useAppSelector((store) => !!store.authData.token, shallowEqual);
const dispatch = useDispatch();
const [createAdmin, { isLoading: isSigningUp, isError: signUpError, isSuccess: signUpOk }] =
useCreateAdminMutation();