fixed moodle logic
This commit is contained in:
@@ -4,8 +4,12 @@ export const getMoodleUserById = async (id: string) => {
|
||||
const { data: user } = await axios.get(
|
||||
`${process.env.NEXT_PUBLIC_MOODLE_URL}/webservice/rest/server.php`,
|
||||
{
|
||||
auth: {
|
||||
username: "moodleuser",
|
||||
password: "Xo1SXaLYBa7Yb6WW",
|
||||
},
|
||||
params: {
|
||||
wstoken: process.env.MOODLE_TOKEN,
|
||||
wstoken: process.env.MOODLE_API_TOKEN,
|
||||
wsfunction: "core_user_get_users_by_field",
|
||||
moodlewsrestformat: "json",
|
||||
field: "idnumber",
|
||||
@@ -33,8 +37,12 @@ export const getMoodleQuizResult = async (userId: string, quizId: string) => {
|
||||
const { data: quizzes } = await axios.get(
|
||||
`${process.env.NEXT_PUBLIC_MOODLE_URL}/webservice/rest/server.php`,
|
||||
{
|
||||
auth: {
|
||||
username: "moodleuser",
|
||||
password: "Xo1SXaLYBa7Yb6WW",
|
||||
},
|
||||
params: {
|
||||
wstoken: process.env.MOODLE_TOKEN,
|
||||
wstoken: process.env.MOODLE_API_TOKEN,
|
||||
wsfunction: "mod_quiz_get_user_attempts",
|
||||
moodlewsrestformat: "json",
|
||||
quizid: quizId,
|
||||
@@ -49,8 +57,12 @@ export const getMoodleCourseCompletionStatus = async (userId: string, courseId:
|
||||
const { data: completionStatus } = await axios.get(
|
||||
`${process.env.NEXT_PUBLIC_MOODLE_URL}/webservice/rest/server.php`,
|
||||
{
|
||||
auth: {
|
||||
username: "moodleuser",
|
||||
password: "Xo1SXaLYBa7Yb6WW",
|
||||
},
|
||||
params: {
|
||||
wstoken: process.env.MOODLE_TOKEN,
|
||||
wstoken: process.env.MOODLE_API_TOKEN,
|
||||
wsfunction: "core_completion_get_course_completion_status",
|
||||
moodlewsrestformat: "json",
|
||||
userid: userId,
|
||||
|
||||
Reference in New Issue
Block a user