Skip to content

Commit

Permalink
Fix: add base url
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilalekha committed Aug 5, 2021
1 parent 1170608 commit e427397
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pages/curriculum/[courseName]/[chapterName].js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { useEffect, useContext, useState } from "react";
import { useRouter } from "next/router";
import Link from "next/link";
import Head from "next/head";
import Cookies from "universal-cookie";
import hljs from "highlight.js";
import javascript from "highlight.js/lib/languages/javascript";

import { getAllChapterIds, getChapterData } from "../../../lib/jslist";
import { getCourse } from "../../../lib/getCourse";
import { courses } from "../../../courses/meta";
import Editor from "../../../component/editor/Editor";
import Output from "../../../component/layout/Output/Output";
import Sidebar from "../../../component/layout/SideBar/SideBar";
import SiteHeader from "../../../component/layout/SiteHeader/SiteHeader";
import hljs from "highlight.js";
import javascript from "highlight.js/lib/languages/javascript";
import { useEffect, useContext, useState } from "react";
import UserState from "../../../context/user/userContext";
import { useRouter } from "next/router";
import Link from "next/link";
import { baseUrl } from "../../../config/config";

const axios = require("axios");
import Cookies from "universal-cookie";
import "highlight.js/styles/tomorrow-night-blue.css";

hljs.registerLanguage("javascript", javascript);
Expand Down Expand Up @@ -57,7 +60,7 @@ export default function Chapter({ chapterData, chapterName, courseName }) {
axios({
method: "post",
mode: "no-cors",
url: `http://localhost:8080/api/enrol/${courseName}/${chapterName}`,
url: `${baseUrl}/api/enrol/${courseName}/${chapterName}`,
headers: {
"x-access-token": `${cook.accessToken}`
}
Expand All @@ -71,7 +74,7 @@ export default function Chapter({ chapterData, chapterName, courseName }) {
}

let progress = JSON.parse(window.localStorage.getItem("progress"));
if(!progress) progress = []
if (!progress) progress = [];
const Course = progress.find((post, index) => {
if (post.courseName === courseName) {
return true;
Expand Down

0 comments on commit e427397

Please sign in to comment.