fixing media URL
This commit is contained in:
parent
d544bc3359
commit
cc0b7b3e6f
|
|
@ -4,7 +4,7 @@ import logo from '../../../assets/images/logo-w.png';
|
||||||
import logoutIllustration from '../../../assets/images/illustration/logout.png';
|
import logoutIllustration from '../../../assets/images/illustration/logout.png';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import useAuth from '../../../roles/guest/auth/hooks/useAuth';
|
import useAuth from '../../../roles/guest/auth/hooks/useAuth';
|
||||||
import { API_URL } from '../../../utils/Constant';
|
import { MEDIA_URL } from '../../../utils/Constant';
|
||||||
import avatar from '../../../assets/images/default-avatar.jpg';
|
import avatar from '../../../assets/images/default-avatar.jpg';
|
||||||
|
|
||||||
function validName(fullName) {
|
function validName(fullName) {
|
||||||
|
|
@ -54,7 +54,7 @@ const AdminNavbar = () => {
|
||||||
<Dropdown as={ButtonGroup} align='end' className='ms-auto me-4 rounded rounded-35'>
|
<Dropdown as={ButtonGroup} align='end' className='ms-auto me-4 rounded rounded-35'>
|
||||||
<Button variant="white" className='d-flex'>
|
<Button variant="white" className='d-flex'>
|
||||||
{/* <i className="me-2 bi bi-person-circle"></i> */}
|
{/* <i className="me-2 bi bi-person-circle"></i> */}
|
||||||
<img src={picture ? `${API_URL}/uploads/avatar/${picture}` : avatar} alt="profile"
|
<img src={picture ? `${MEDIA_URL}/avatar/${picture}` : avatar} alt="profile"
|
||||||
style={{
|
style={{
|
||||||
objectFit:"cover",
|
objectFit:"cover",
|
||||||
height:"24px",
|
height:"24px",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
||||||
import { Nav, Button } from 'react-bootstrap';
|
import { Nav, Button } from 'react-bootstrap';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
import avatar from '../../../assets/images/default-avatar.jpg';
|
import avatar from '../../../assets/images/default-avatar.jpg';
|
||||||
import { API_URL } from '../../../utils/Constant';
|
import { MEDIA_URL } from '../../../utils/Constant';
|
||||||
|
|
||||||
function validName(fullName) {
|
function validName(fullName) {
|
||||||
const nameArray = fullName.split(" ");
|
const nameArray = fullName.split(" ");
|
||||||
|
|
@ -26,7 +26,7 @@ const TeacherSideNav = () => {
|
||||||
</Button>
|
</Button>
|
||||||
<div className="position-sticky pt-4">
|
<div className="position-sticky pt-4">
|
||||||
<div className="d-flex flex-column items-center mb-3 border-bottom">
|
<div className="d-flex flex-column items-center mb-3 border-bottom">
|
||||||
<img src={picture ? `${API_URL}/uploads/avatar/${picture}` : avatar} alt=""
|
<img src={picture ? `${MEDIA_URL}/avatar/${picture}` : avatar} alt=""
|
||||||
className="img-avatar"
|
className="img-avatar"
|
||||||
height={72} width={72}
|
height={72} width={72}
|
||||||
style={{objectFit:'cover'}}
|
style={{objectFit:'cover'}}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
||||||
import { Nav, Button } from 'react-bootstrap';
|
import { Nav, Button } from 'react-bootstrap';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
import avatar from '../../../assets/images/default-avatar.jpg';
|
import avatar from '../../../assets/images/default-avatar.jpg';
|
||||||
import { API_URL } from '../../../utils/Constant';
|
import { MEDIA_URL } from '../../../utils/Constant';
|
||||||
|
|
||||||
function validName(fullName) {
|
function validName(fullName) {
|
||||||
const nameArray = fullName.split(" ");
|
const nameArray = fullName.split(" ");
|
||||||
|
|
@ -26,7 +26,7 @@ const UserSideNav = () => {
|
||||||
</Button>
|
</Button>
|
||||||
<div className="position-sticky pt-4">
|
<div className="position-sticky pt-4">
|
||||||
<div className="d-flex flex-column items-center mb-3 border-bottom">
|
<div className="d-flex flex-column items-center mb-3 border-bottom">
|
||||||
<img src={picture ? `${API_URL}/uploads/avatar/${picture}` : avatar} alt=""
|
<img src={picture ? `${MEDIA_URL}/avatar/${picture}` : avatar} alt=""
|
||||||
className="img-avatar"
|
className="img-avatar"
|
||||||
height={72} width={72}
|
height={72} width={72}
|
||||||
style={{objectFit:'cover'}}
|
style={{objectFit:'cover'}}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ const useUpdateExercises = (levelId) => {
|
||||||
const [topicName, setTopicName] = useState('topic');
|
const [topicName, setTopicName] = useState('topic');
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const mediaPath = `${MEDIA_URL}/uploads/exercise`;
|
const mediaPath = `${MEDIA_URL}/exercise`;
|
||||||
|
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
ID_ADMIN_EXERCISE: "",
|
ID_ADMIN_EXERCISE: "",
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const useTest = (materialId) => {
|
||||||
const editorContainerRef = useRef(null);
|
const editorContainerRef = useRef(null);
|
||||||
const editorRef = useRef(null);
|
const editorRef = useRef(null);
|
||||||
const [isLayoutReady, setIsLayoutReady] = useState(false);
|
const [isLayoutReady, setIsLayoutReady] = useState(false);
|
||||||
const mediaPath = `${MEDIA_URL}/uploads/level/`;
|
const mediaPath = `${MEDIA_URL}/level/`;
|
||||||
|
|
||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const useUpdateMaterials = (materialId) => {
|
||||||
const [topicName, setTopicName] = useState('topic');
|
const [topicName, setTopicName] = useState('topic');
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const mediaPath = `${MEDIA_URL}/uploads/level`;
|
const mediaPath = `${MEDIA_URL}/level`;
|
||||||
|
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
content: '',
|
content: '',
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import sectionService from '../services/serviceSections';
|
||||||
import { MEDIA_URL } from '../../../../utils/Constant';
|
import { MEDIA_URL } from '../../../../utils/Constant';
|
||||||
|
|
||||||
const useSections = () => {
|
const useSections = () => {
|
||||||
const thumbPath = `${MEDIA_URL}/uploads/section/`;
|
const thumbPath = `${MEDIA_URL}/section/`;
|
||||||
const [sections, setSections] = useState([]);
|
const [sections, setSections] = useState([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const useSettings = () => {
|
||||||
const [loadingUpdate, setLoadingUpdate] = useState(false);
|
const [loadingUpdate, setLoadingUpdate] = useState(false);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const [success, setSuccess] = useState(false);
|
const [success, setSuccess] = useState(false);
|
||||||
const thumbPath = `${MEDIA_URL}/uploads/avatar/`;
|
const thumbPath = `${MEDIA_URL}/avatar/`;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const useSettings = () => {
|
||||||
const [loadingUpdate, setLoadingUpdate] = useState(false);
|
const [loadingUpdate, setLoadingUpdate] = useState(false);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const [success, setSuccess] = useState(false);
|
const [success, setSuccess] = useState(false);
|
||||||
const thumbPath = `${MEDIA_URL}/uploads/avatar/`;
|
const thumbPath = `${MEDIA_URL}/avatar/`;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ const useDashboards = () => {
|
||||||
const [journey, setJourney] = useState([]);
|
const [journey, setJourney] = useState([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const thumbPath = `${MEDIA_URL}/uploads/section/`;
|
const thumbPath = `${MEDIA_URL}/section/`;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
import { MEDIA_URL } from '../../../../../utils/Constant';
|
import { MEDIA_URL } from '../../../../../utils/Constant';
|
||||||
|
|
||||||
const ExerciseMedia = ({ image, audio, video }) => {
|
const ExerciseMedia = ({ image, audio, video }) => {
|
||||||
const mediaPath = `${MEDIA_URL}/uploads/exercise`;
|
const mediaPath = `${MEDIA_URL}/exercise`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ const MatchingPairsQuestion = ({ question, onAnswer, studentAnswer, index }) =>
|
||||||
};
|
};
|
||||||
|
|
||||||
const mediaUrls = [];
|
const mediaUrls = [];
|
||||||
const mediaPath = `${MEDIA_URL}/uploads/exercise`;
|
const mediaPath = `${MEDIA_URL}/exercise`;
|
||||||
|
|
||||||
if (question.IMAGE) mediaUrls.push(`${mediaPath}/image/${question.IMAGE}`);
|
if (question.IMAGE) mediaUrls.push(`${mediaPath}/image/${question.IMAGE}`);
|
||||||
if (question.AUDIO) mediaUrls.push(`${mediaPath}/audio/${question.AUDIO}`);
|
if (question.AUDIO) mediaUrls.push(`${mediaPath}/audio/${question.AUDIO}`);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const MultipleChoiceQuestion = ({ question, onAnswer, studentAnswer, index }) =>
|
||||||
const options = question.multipleChoices[0];
|
const options = question.multipleChoices[0];
|
||||||
|
|
||||||
const mediaUrls = [];
|
const mediaUrls = [];
|
||||||
const mediaPath = `${MEDIA_URL}/uploads/exercise`;
|
const mediaPath = `${MEDIA_URL}/exercise`;
|
||||||
|
|
||||||
if (question.IMAGE) mediaUrls.push(`${mediaPath}/image/${question.IMAGE}`);
|
if (question.IMAGE) mediaUrls.push(`${mediaPath}/image/${question.IMAGE}`);
|
||||||
if (question.AUDIO) mediaUrls.push(`${mediaPath}/audio/${question.AUDIO}`);
|
if (question.AUDIO) mediaUrls.push(`${mediaPath}/audio/${question.AUDIO}`);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { MEDIA_URL } from '../../../../../utils/Constant';
|
||||||
const TrueFalseQuestion = ({ question, onAnswer, studentAnswer, index }) => {
|
const TrueFalseQuestion = ({ question, onAnswer, studentAnswer, index }) => {
|
||||||
const savedAnswer = studentAnswer !== null ? studentAnswer.ANSWER_STUDENT : null;
|
const savedAnswer = studentAnswer !== null ? studentAnswer.ANSWER_STUDENT : null;
|
||||||
const mediaUrls = [];
|
const mediaUrls = [];
|
||||||
const mediaPath = `${MEDIA_URL}/uploads/exercise`;
|
const mediaPath = `${MEDIA_URL}/exercise`;
|
||||||
|
|
||||||
if (question.IMAGE) mediaUrls.push(`${mediaPath}/image/${question.IMAGE}`);
|
if (question.IMAGE) mediaUrls.push(`${mediaPath}/image/${question.IMAGE}`);
|
||||||
if (question.AUDIO) mediaUrls.push(`${mediaPath}/audio/${question.AUDIO}`);
|
if (question.AUDIO) mediaUrls.push(`${mediaPath}/audio/${question.AUDIO}`);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ const useSections = () => {
|
||||||
const [sections, setSections] = useState([]);
|
const [sections, setSections] = useState([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const thumbPath = `${MEDIA_URL}/uploads/section/`;
|
const thumbPath = `${MEDIA_URL}/section/`;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import useMaterial from '../hooks/useMaterials';
|
||||||
|
|
||||||
import MediaViewer from './components/MediaViewer';
|
import MediaViewer from './components/MediaViewer';
|
||||||
|
|
||||||
import { API_URL } from '../../../../utils/Constant';
|
import { MEDIA_URL } from '../../../../utils/Constant';
|
||||||
|
|
||||||
import { unSlugify } from '../../../../utils/Constant';
|
import { unSlugify } from '../../../../utils/Constant';
|
||||||
import Skeleton from 'react-loading-skeleton';
|
import Skeleton from 'react-loading-skeleton';
|
||||||
|
|
@ -19,7 +19,7 @@ const Material = () => {
|
||||||
const [localLoader, setLoader]= useState(true);
|
const [localLoader, setLoader]= useState(true);
|
||||||
|
|
||||||
const [mediaUrls, setMedia] = useState([]);
|
const [mediaUrls, setMedia] = useState([]);
|
||||||
const mediaPath = `${API_URL}/uploads/level`;
|
const mediaPath = `${MEDIA_URL}/level`;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!loading) {
|
if (!loading) {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const useSettings = () => {
|
||||||
const [loadingUpdate, setLoadingUpdate] = useState(false);
|
const [loadingUpdate, setLoadingUpdate] = useState(false);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const [success, setSuccess] = useState(false);
|
const [success, setSuccess] = useState(false);
|
||||||
const thumbPath = `${MEDIA_URL}/uploads/avatar/`;
|
const thumbPath = `${MEDIA_URL}/avatar/`;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ const useTopics = (sectionId) => {
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const [sections, setSection] = useState(null);
|
const [sections, setSection] = useState(null);
|
||||||
const thumbPath = `${MEDIA_URL}/uploads/section/`;
|
const thumbPath = `${MEDIA_URL}/section/`;
|
||||||
const { sectionSlugMap } = useSlugContext();
|
const { sectionSlugMap } = useSlugContext();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
export const API_URL = 'http://54.173.167.62/api';
|
export const API_URL = 'http://54.173.167.62/api';
|
||||||
export const MEDIA_URL = 'http://54.173.167.62/media';
|
export const MEDIA_URL = 'http://54.173.167.62/public';
|
||||||
|
|
||||||
export const slugify = (text) => {
|
export const slugify = (text) => {
|
||||||
if (!text) {
|
if (!text) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user