Skip to content

Conversation

@A-lexisL
Copy link
Contributor

@A-lexisL A-lexisL commented Jan 19, 2026

Implement:
#3
#7 (comment)
#9

@A-lexisL A-lexisL moved this from Todo to In Progress in Course Review Jan 19, 2026
@A-lexisL A-lexisL marked this pull request as draft January 20, 2026 07:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the backend API interface by consolidating API calls into composables and updating the endpoint structure. The changes move authentication logic from utils/auth.js to composables/useAuth.js, introduce a centralized apiFetch utility, and update API endpoints from singular (/api/course/) to plural (/api/courses/) naming conventions.

Changes:

  • Centralized API calls through a new apiFetch utility function with configurable base URL
  • Moved authentication functions from utils to composables for better organization
  • Updated all API endpoints to use RESTful plural resource naming (e.g., /api/courses/, /api/reviews/)
  • Added new composables: useLanding and expanded useCourses with fetchCourse function

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
vite.config.js Removed commented-out proxy rewrite configuration
src/views/Login.vue Updated to use loginWithPassword from useAuth composable instead of utils
src/views/Home.vue Integrated useLanding composable to fetch landing data
src/views/CourseReviewSearch.vue Refactored to use searchCourseReviews from useReviews and fetchCourse from useCourses
src/views/CourseDetail.vue Updated review submission/deletion to use new API endpoints and improved error handling
src/views/AuthCallback.vue Updated to use verifyCallback from useAuth composable
src/utils/auth.js Removed auth functions (moved to composables), kept only helper functions and constants
src/utils/api.js Replaced authentication check with new apiFetch utility for centralized API calls
src/composables/useReviews.js Updated all endpoints to new URL structure and added searchCourseReviews function
src/composables/useLanding.js New composable for landing page data fetching
src/composables/useCourses.js Added fetchCourse function and updated to handle DRF pagination format
src/composables/useAuth.js Consolidated authentication functions moved from utils with apiFetch integration
src/components/SetPasswordForm.vue Updated to use setPassword from useAuth composable
src/components/ReviewCard.vue Removed console.error statement in error handling
src/components/CourseList.vue Updated sort field name from "num_reviews" to "review_count" and added padding to input
src/components/AuthInitiate.vue Updated to use initiateAuth from useAuth composable
bun.lock Updated dependency versions from "latest" to specific semantic versions
.env.example Added VITE_API_BASE_URL environment variable for configurable API base URL

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@A-lexisL A-lexisL marked this pull request as ready for review January 21, 2026 09:51
@A-lexisL A-lexisL requested a review from Copilot January 21, 2026 09:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

searchQuery.value = route.query.q || "";
await checkAuthentication();
await fetchCourseInfo();
await fetchReviews();
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The watch effect on route.query.q has immediate: true, and onMounted also calls fetchReviews(). This means fetchReviews() will be called twice on component mount - once from the watch with immediate: true and once from onMounted. This is inefficient and could cause race conditions or duplicate API calls. Consider removing the fetchReviews() call from onMounted since the watch with immediate: true will handle the initial fetch.

Suggested change
await fetchReviews();

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Redundant checkAuthentication call/event stack and isolated isAuthenticated Interface changed

3 participants