package com.luojia_channel.common.config;

import com.luojia_channel.common.interceptor.AuthInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@RequiredArgsConstructor
public class WebMvcConfig implements WebMvcConfigurer {
    private final AuthInterceptor authInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 拦截器
        registry.addInterceptor(authInterceptor)
                .excludePathPatterns("/user/login",
                        "/user/register",
                        "/user/captcha",
                        "/user/verify-captcha",
                        "/user/info/getuserinfo",
                        "/post/list",
                        "/post/detail",
                        "/comment/list",
                        "/comment/list/reply",
                        "/openapi/luojia-channel",
                        "/swagger-ui.html"
                );
    }

}
