Skip to content

Commit

Permalink
Update APIServices.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraFgar committed Dec 6, 2023
1 parent 95196cc commit 89b517e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/services/APIServices.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import Cookies from 'js-cookie';
import { getConfig } from '@edx/frontend-platform';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';

class APIService {
visit = async (course_id, block_id) => {
const URL = `/api/v1/courses/course/${course_id}/block/${block_id}/visit`;
const lmsSessionIdCookie = Cookies.get('lms_sessionid');
console.log('COOKIESSS', lmsSessionIdCookie)
const { userId } = getAuthenticatedUser();
const URL = `/api/v1/courses/user/${userId}/course/${course_id}/block/${block_id}/visit`;

console.log('USER_ID', userId)
try {

const response = await fetch(getConfig().API_GW_URL + URL, {
method: 'GET',
headers: {
'Cookie': `lms_sessionid=${lmsSessionIdCookie}`,
},
method: 'GET'
});

console.log('response', response);
Expand Down

0 comments on commit 89b517e

Please sign in to comment.