feat: переделал все клиентские запросы на другие endpoint для безопастности
Backend CI / build-and-test (push) Successful in 48s
Frontend CI / build-and-check (push) Failing after 5m13s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 15s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 1m9s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 26s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 14s

This commit is contained in:
2026-05-18 03:27:16 +03:00
parent 6eeacd80cc
commit 19ea303782
19 changed files with 660 additions and 96 deletions
+4 -4
View File
@@ -46,17 +46,17 @@ export const useLecturesStore = defineStore('lectures', () => {
}
}
async function fetchRegisteredForUser(userId: string) {
async function fetchRegisteredForCurrentUser() {
try {
const enrollments = await usersApi.enrollments(userId)
const enrollments = await usersApi.myEnrollments()
const mapped = enrollments.map(mapApiLecture)
registered.value = mapped.map(lecture => lecture.id)
if (mapped.length) {
mapped.forEach(lecture => {
const index = lectures.value.findIndex(item => item.id === lecture.id)
if (index >= 0) lectures.value[index] = { ...lectures.value[index], ...lecture, registered: true }
else lectures.value.push({ ...lecture, registered: true })
})
registered.value = mapped.map(lecture => lecture.id)
}
} catch {
// Some backend builds return an empty 200 for this endpoint; catalog detail still carries isEnrolled.
@@ -108,7 +108,7 @@ export const useLecturesStore = defineStore('lectures', () => {
registeredLectures,
fetchLectures,
fetchLecture,
fetchRegisteredForUser,
fetchRegisteredForCurrentUser,
fetchReviews,
register,
unregister,
+5 -6
View File
@@ -12,18 +12,17 @@ export const useUserStore = defineStore('user', () => {
const loading = ref(false)
const error = ref<string | null>(null)
async function fetchStudentData(userId?: string) {
async function fetchStudentData() {
const auth = useAuthStore()
const id = userId ?? auth.user?.id
if (!id) return
if (!auth.user) return
loading.value = true
error.value = null
try {
const [stats, achievementPayload, transactions] = await Promise.all([
usersApi.stats(id),
usersApi.achievements(id),
usersApi.transactions(id),
usersApi.myStats(),
usersApi.myAchievements(),
usersApi.myTransactions(),
])
const [achievementCatalog, notificationPayload] = await Promise.all([
achievementsApi.list(),