refactor: store folder for redux
This commit is contained in:
@ -8,7 +8,7 @@ import { Auth } from "@/client";
|
||||
import SCOPES from "@/constants/scopes";
|
||||
import { Scopes } from "@/enums/Scopes";
|
||||
import { notifications } from "@/lib/notifications";
|
||||
import { RootState } from "@/lib/store";
|
||||
import { RootState } from "@/lib/store/store";
|
||||
|
||||
const ConsentButton: FC = () => {
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
@ -4,15 +4,17 @@ import PageItem from "@/components/PageBlock/PageItem";
|
||||
import PageContainer from "@/components/PageContainer/PageContainer";
|
||||
|
||||
interface LoginPageProps {
|
||||
searchParams: { login_challenge?: string };
|
||||
searchParams: Promise<{ login_challenge?: string }>;
|
||||
}
|
||||
|
||||
export default function LoginPage({ searchParams }: LoginPageProps) {
|
||||
export default async function LoginPage({ searchParams }: LoginPageProps) {
|
||||
const params = await searchParams;
|
||||
|
||||
return (
|
||||
<PageContainer center>
|
||||
<PageItem fullScreenMobile>
|
||||
<Logo title={"Вход"} />
|
||||
<LoginForm loginChallenge={searchParams.login_challenge} />
|
||||
<LoginForm loginChallenge={params.login_challenge} />
|
||||
</PageItem>
|
||||
</PageContainer>
|
||||
);
|
||||
|
||||
@ -7,8 +7,8 @@ import styles from "@/app/services/components/ServicesList/ServicesList.module.c
|
||||
import TitleWithLines from "@/components/TitleWithLines/TitleWithLines";
|
||||
import SCOPES from "@/constants/scopes";
|
||||
import { Scopes } from "@/enums/Scopes";
|
||||
import { setTargetService } from "@/lib/features/targetService/targetServiceSlice";
|
||||
import { useAppDispatch } from "@/lib/store";
|
||||
import { setTargetService } from "@/lib/store/features/targetService/targetServiceSlice";
|
||||
import { useAppDispatch } from "@/lib/store/store";
|
||||
import ServiceData from "@/types/ServiceData";
|
||||
|
||||
const ServicesList = () => {
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
import { FC, useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { Button } from "@mantine/core";
|
||||
import { setLastSendTime } from "@/lib/features/verification/verificationSlice";
|
||||
import { RootState } from "@/lib/store";
|
||||
import { MAX_COUNTDOWN } from "@/constants/verification";
|
||||
import { setLastSendTime } from "@/lib/store/features/verification/verificationSlice";
|
||||
import { RootState } from "@/lib/store/store";
|
||||
|
||||
const ResendVerificationCode: FC = () => {
|
||||
const [countdown, setCountdown] = useState(0);
|
||||
|
||||
@ -9,7 +9,7 @@ import ResendVerificationCode from "@/app/verify-phone/components/ResendVerifica
|
||||
import style from "@/app/verify-phone/components/VerifyPhoneForm/VerifyPhone.module.css";
|
||||
import { Auth } from "@/client";
|
||||
import { notifications } from "@/lib/notifications";
|
||||
import { RootState } from "@/lib/store";
|
||||
import { RootState } from "@/lib/store/store";
|
||||
|
||||
type VerifyNumberForm = {
|
||||
code: string;
|
||||
|
||||
@ -9,9 +9,9 @@ import PhoneInput from "@/components/PhoneInput/PhoneInput";
|
||||
import {
|
||||
setLoginChallenge,
|
||||
setPhoneNumber,
|
||||
} from "@/lib/features/auth/authSlice";
|
||||
} from "@/lib/store/features/auth/authSlice";
|
||||
import { notifications } from "@/lib/notifications";
|
||||
import { useAppDispatch } from "@/lib/store";
|
||||
import { useAppDispatch } from "@/lib/store/store";
|
||||
|
||||
type LoginForm = {
|
||||
phoneNumber: string;
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
import { combineReducers } from "@reduxjs/toolkit";
|
||||
import targetServiceReducer from "@/lib/features/targetService/targetServiceSlice";
|
||||
import verificationReducer from "@/lib/features/verification/verificationSlice";
|
||||
import authReducer from "@/lib/features/auth/authSlice";
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
targetService: targetServiceReducer,
|
||||
verification: verificationReducer,
|
||||
auth: authReducer,
|
||||
});
|
||||
|
||||
export default rootReducer;
|
||||
12
src/lib/store/features/rootReducer.ts
Normal file
12
src/lib/store/features/rootReducer.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { combineReducers } from "@reduxjs/toolkit";
|
||||
import authReducer from "@/lib/store/features/auth/authSlice";
|
||||
import targetServiceReducer from "@/lib/store/features/targetService/targetServiceSlice";
|
||||
import verificationReducer from "@/lib/store/features/verification/verificationSlice";
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
targetService: targetServiceReducer,
|
||||
verification: verificationReducer,
|
||||
auth: authReducer,
|
||||
});
|
||||
|
||||
export default rootReducer;
|
||||
@ -2,7 +2,7 @@ import { configureStore } from "@reduxjs/toolkit";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { persistReducer, persistStore } from "redux-persist";
|
||||
import storage from "redux-persist/lib/storage";
|
||||
import rootReducer from "@/lib/features/rootReducer";
|
||||
import rootReducer from "@/lib/store/features/rootReducer";
|
||||
|
||||
const persistConfig = {
|
||||
key: "root",
|
||||
@ -3,7 +3,7 @@
|
||||
import { ReactNode } from "react";
|
||||
import { Provider } from "react-redux";
|
||||
import { PersistGate } from "redux-persist/integration/react";
|
||||
import { persistor, store } from "@/lib/store";
|
||||
import { persistor, store } from "@/lib/store/store";
|
||||
|
||||
type Props = {
|
||||
children: ReactNode;
|
||||
|
||||
Reference in New Issue
Block a user