我有一个 React 应用程序,其中使用 redux 设置全局状态,在一个组件中填充表单,并根据输入向同一端点发出 axios 请求,从 redux 获取数据,然后我想重定向到另一个端点组件并根据这个新请求过滤状态。问题是,当我重定向时,会显示 redux 定义的相同状态,而不会显示更新的状态。
\n我的 redux 逻辑是这样的:
\nactionsCreatorproductActions.js
\nimport { fetchProductsStart, fetchProductsSuccess, fetchProductsFailure } from '../slices/productsSlice';\nimport { baseUrl } from '../../shared/baseUrl';\n\nexport const fetchProducts = () => async dispatch => {\n try {\n dispatch(fetchProductsStart());\n const response = await fetch(baseUrl+"products");\n const data = await response.json();\n dispatch(fetchProductsSuccess(data));\n } catch (error) {\n dispatch(fetchProductsFailure(error));\n }\n};\nRun Code Online (Sandbox Code Playgroud)\n切片减速器是productsSlice.js
\nimport { createSlice } from "@reduxjs/toolkit";\n\n\nconst productsSlice = createSlice({\n name: "products",\n initialState: {\n products: [],\n …Run Code Online (Sandbox Code Playgroud) I am trying to migrate a code that used the old springboot security configuration with the WebSecurityConfigurerAdapter to the new component based security config, i have a custom authentication filter that extends UsernamePasswordAuthenticationFilter that want to include in my SecurityFilterChain bean as is showed here:
SecurityConfig.java file
package com.tito.userservice.security;
import com.tito.userservice.filter.CustomAuthenticationFilter;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
@Configuration @EnableWebSecurity @RequiredArgsConstructor
public class …Run Code Online (Sandbox Code Playgroud) java ×1
javascript ×1
maven ×1
react-redux ×1
reactjs ×1
redux ×1
spring-boot ×1
spring-mvc ×1