feat: move api url to env (#23)
This commit is contained in:
+3
-1
@@ -1,4 +1,5 @@
|
||||
<script>
|
||||
import { PUBLIC_SERVER_URL } from '$env/static/public';
|
||||
import { course } from '$lib/components/Course/store';
|
||||
import { currentOrg } from '$lib/utils/store/org';
|
||||
import { profile } from '$lib/utils/store/user';
|
||||
@@ -9,7 +10,7 @@
|
||||
|
||||
const downLoadCertificate = async () => {
|
||||
isLoading = true;
|
||||
const response = await fetch('https://classroomio-server.fly.dev/downloadCertificate', {
|
||||
const response = await fetch(PUBLIC_SERVER_URL + '/downloadCertificate', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -48,6 +49,7 @@
|
||||
label="DownLoad Certificate"
|
||||
className="rounded-md"
|
||||
onClick={downLoadCertificate}
|
||||
isDisabled={!PUBLIC_SERVER_URL}
|
||||
{isLoading}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import axios from 'axios';
|
||||
import { PUBLIC_SERVER_URL } from '$env/static/public';
|
||||
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
||||
import {
|
||||
lesson,
|
||||
@@ -40,7 +41,7 @@
|
||||
try {
|
||||
const response = await axios({
|
||||
method: 'POST',
|
||||
url: 'https://classroomio-server.fly.dev/uploadVideo?lessonId=' + lessonId,
|
||||
url: PUBLIC_SERVER_URL + '/uploadVideo?lessonId=' + lessonId,
|
||||
data: formData,
|
||||
maxContentLength: Infinity,
|
||||
maxBodyLength: Infinity,
|
||||
@@ -112,7 +113,7 @@
|
||||
type="button"
|
||||
on:click={() => (fileInput && !isLoading ? fileInput.click() : null)}
|
||||
class="w-full h-full"
|
||||
disabled={isLoading}
|
||||
disabled={isLoading || !PUBLIC_SERVER_URL}
|
||||
>
|
||||
<form
|
||||
class="h-full w-full flex flex-col items-center justify-center border border-primary-300 border-dashed rounded-xl"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { CodeSnippet, Grid, Row, Column, Toggle } from 'carbon-components-svelte';
|
||||
import { PUBLIC_SERVER_URL } from '$env/static/public';
|
||||
|
||||
import SectionTitle from '$lib/components/Org/SectionTitle.svelte';
|
||||
import TextField from '$lib/components/Form/TextField.svelte';
|
||||
@@ -53,7 +54,7 @@
|
||||
slideUrl: lesson.slide_url || '',
|
||||
video: lesson.videos || ''
|
||||
}));
|
||||
const response = await fetch('https://classroomio-server.fly.dev/downloadCourse', {
|
||||
const response = await fetch(PUBLIC_SERVER_URL + '/downloadCourse', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -291,7 +292,7 @@
|
||||
variant={VARIANTS.OUTLINED}
|
||||
label="Download"
|
||||
onClick={downloadCourse}
|
||||
isDisabled={isLoading}
|
||||
isDisabled={isLoading || !PUBLIC_SERVER_URL}
|
||||
{isLoading}
|
||||
/>
|
||||
</Column>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import CourseContainer from '$lib/components/CourseContainer/index.svelte';
|
||||
import { fetchCourse, fetchLesson, updateLessonCompletion } from '$lib/utils/services/courses';
|
||||
import { PUBLIC_SERVER_URL } from '$env/static/public';
|
||||
import { fetchLesson, updateLessonCompletion } from '$lib/utils/services/courses';
|
||||
import CheckmarkOutlineIcon from 'carbon-icons-svelte/lib/CheckmarkOutline.svelte';
|
||||
import CheckmarkFilledIcon from 'carbon-icons-svelte/lib/CheckmarkFilled.svelte';
|
||||
import ListChecked from 'carbon-icons-svelte/lib/ListChecked.svelte';
|
||||
@@ -126,7 +127,7 @@
|
||||
const lessonNumber = getLessonOrder(currentLesson.id);
|
||||
const slideUrl = $lesson.materials.slide_url || '';
|
||||
|
||||
const response = await fetch('https://classroomio-server.fly.dev/downloadLesson', {
|
||||
const response = await fetch(PUBLIC_SERVER_URL + '/downloadLesson', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -253,7 +254,7 @@
|
||||
: 'hidden'
|
||||
} lg:flex items-center`}
|
||||
>
|
||||
{#if $course.metadata.lessonDownload}
|
||||
{#if $course.metadata.lessonDownload && !!PUBLIC_SERVER_URL}
|
||||
<PrimaryButton
|
||||
className="mb-2 lg:mb-0 mr-2"
|
||||
variant={VARIANTS.OUTLINED}
|
||||
|
||||
Reference in New Issue
Block a user