feat: fix some code

This commit is contained in:
tim
2025-08-09 16:47:40 +08:00
parent 411d24194b
commit 6b5b6b8c81
2 changed files with 6 additions and 2 deletions

View File

@@ -112,6 +112,7 @@ public class SecurityConfig {
.requestMatchers(HttpMethod.POST,"/api/auth/reason").permitAll()
.requestMatchers(HttpMethod.GET, "/api/search/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/users/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/medals/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/push/public-key").permitAll()
.requestMatchers(HttpMethod.GET, "/api/reaction-types").permitAll()
.requestMatchers(HttpMethod.GET, "/api/activities/**").permitAll()
@@ -147,7 +148,7 @@ public class SecurityConfig {
uri.startsWith("/api/search") || uri.startsWith("/api/users") ||
uri.startsWith("/api/reaction-types") || uri.startsWith("/api/config") ||
uri.startsWith("/api/activities") || uri.startsWith("/api/push/public-key") ||
uri.startsWith("/api/sitemap.xml"));
uri.startsWith("/api/sitemap.xml") || uri.startsWith("/api/medals"));
if (authHeader != null && authHeader.startsWith("Bearer ")) {
String token = authHeader.substring(7);

View File

@@ -26,7 +26,7 @@
<script setup>
import { ref, watch } from 'vue'
import { API_BASE_URL } from '../main'
import { API_BASE_URL, toast } from '../main'
const props = defineProps({
userId: {
@@ -41,6 +41,9 @@ const fetchMedals = async () => {
const res = await fetch(`${API_BASE_URL}/api/medals?userId=${props.userId}`)
if (res.ok) {
medals.value = await res.json()
} else {
medals.value = []
toast.error('获取成就失败')
}
}