mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-18 20:09:25 +00:00
chore: refactor services folder
This commit is contained in:
parent
b16daaa780
commit
9ccf99a86f
35 changed files with 41 additions and 41 deletions
|
|
@ -8,7 +8,7 @@ import { getLecture } from "@services/courses/lectures";
|
|||
import AuthProvider from "@components/Security/AuthProvider";
|
||||
import EditorWrapper from "@components/Editor/EditorWrapper";
|
||||
import useSWR, { mutate } from "swr";
|
||||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { swrFetcher } from "@services/utils/requests";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
"use client";
|
||||
import { getAPIUrl, getBackendUrl } from "@services/config";
|
||||
import { getAPIUrl, getBackendUrl } from "@services/config/config";
|
||||
import { swrFetcher } from "@services/utils/requests";
|
||||
import React from "react";
|
||||
import { styled } from "styled-components";
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
import { Title } from "@components/UI/Elements/Styles/Title";
|
||||
import { createCollection } from "@services/collections";
|
||||
import { createCollection } from "@services/courses/collections";
|
||||
import useSWR from "swr";
|
||||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { swrFetcher } from "@services/utils/requests";
|
||||
import { getOrganizationContextInfo } from "@services/orgs";
|
||||
import { getOrganizationContextInfo } from "@services/organizations/orgs";
|
||||
|
||||
function NewCollection(params : any) {
|
||||
const orgslug = params.params.orgslug;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import Link from "next/link";
|
|||
import React from "react";
|
||||
import styled from "styled-components";
|
||||
import { Title } from "@components/UI/Elements/Styles/Title";
|
||||
import { deleteCollection } from "@services/collections";
|
||||
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config";
|
||||
import { deleteCollection } from "@services/courses/collections";
|
||||
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config/config";
|
||||
import { swrFetcher } from "@services/utils/requests";
|
||||
import useSWR, { mutate } from "swr";
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { useRouter } from "next/navigation";
|
|||
import NewChapterModal from "@components/Modals/CourseEdit/NewChapter";
|
||||
import NewLectureModal from "@components/Modals/CourseEdit/NewLecture";
|
||||
import { createLecture, createFileLecture } from "@services/courses/lectures";
|
||||
import { getOrganizationContextInfo } from "@services/orgs";
|
||||
import { getOrganizationContextInfo } from "@services/organizations/orgs";
|
||||
|
||||
function CourseEdit(params: any) {
|
||||
const router = useRouter();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import Link from "next/link";
|
|||
import React, { useMemo } from "react";
|
||||
import Layout from "@components/UI/Layout";
|
||||
import { getLecture } from "@services/courses/lectures";
|
||||
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config";
|
||||
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config/config";
|
||||
import Canva from "@components/LectureViews/DynamicCanva/DynamicCanva";
|
||||
import styled from "styled-components";
|
||||
import { getCourse } from "@services/courses/courses";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { closeActivity, createActivity } from "@services/courses/activity";
|
|||
import Link from "next/link";
|
||||
import React from "react";
|
||||
import styled from "styled-components";
|
||||
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config";
|
||||
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config/config";
|
||||
import useSWR, { mutate } from "swr";
|
||||
import { swrFetcher } from "@services/utils/requests";
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import { Header } from "@components/UI/Header";
|
|||
import Layout from "@components/UI/Layout";
|
||||
import { Title } from "@components/UI/Elements/Styles/Title";
|
||||
import { createNewCourse } from "@services/courses/courses";
|
||||
import { getOrganizationContextInfo } from "@services/orgs";
|
||||
import { getUriWithOrg } from "@services/config";
|
||||
import { getOrganizationContextInfo } from "@services/organizations/orgs";
|
||||
import { getUriWithOrg } from "@services/config/config";
|
||||
|
||||
const NewCoursePage = (params: any) => {
|
||||
const router = useRouter();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { useRouter } from "next/navigation";
|
|||
import React from "react";
|
||||
import styled from "styled-components";
|
||||
import { Title } from "@components/UI/Elements/Styles/Title";
|
||||
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config";
|
||||
import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config/config";
|
||||
import { deleteCourseFromBackend } from "@services/courses/courses";
|
||||
import useSWR, { mutate } from "swr";
|
||||
import { swrFetcher } from "@services/utils/requests";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use client";
|
||||
import { Title } from "@components/UI/Elements/Styles/Title";
|
||||
import { getUriWithOrg } from "@services/config";
|
||||
import { getUriWithOrg } from "@services/config/config";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import React from 'react'
|
||||
import useSWR, { mutate } from "swr";
|
||||
import { swrFetcher } from "@services/utils/requests";
|
||||
import { getAPIUrl } from '@services/config';
|
||||
import { getAPIUrl } from '@services/config/config';
|
||||
import { Field, Form, Formik } from 'formik';
|
||||
import { updateOrganization } from '@services/settings/org';
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import React from "react";
|
||||
import Layout from "../../../components/UI/Layout";
|
||||
import { Title } from "../../../components/UI/Elements/Styles/Title";
|
||||
import { createNewOrganization } from "../../../services/orgs";
|
||||
import { createNewOrganization } from "../../../services/organizations/orgs";
|
||||
|
||||
const Organizations = () => {
|
||||
const [name, setName] = React.useState("");
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ import Link from "next/link";
|
|||
import React from "react";
|
||||
import Layout from "../../components/UI/Layout";
|
||||
import { Title } from "../../components/UI/Elements/Styles/Title";
|
||||
import { deleteOrganizationFromBackend } from "@services/orgs";
|
||||
import { deleteOrganizationFromBackend } from "@services/organizations/orgs";
|
||||
import useSWR, { mutate } from "swr";
|
||||
import { swrFetcher } from "@services/utils/requests";
|
||||
import { getAPIUrl, getUriWithOrg } from "@services/config";
|
||||
import { getAPIUrl, getUriWithOrg } from "@services/config/config";
|
||||
|
||||
const Organizations = () => {
|
||||
const { data : organizations , error } = useSWR(`${getAPIUrl()}orgs/user/page/1/limit/10`, swrFetcher)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import React from "react";
|
|||
import { Draggable } from "react-beautiful-dnd";
|
||||
import { EyeOpenIcon, Pencil2Icon } from '@radix-ui/react-icons'
|
||||
import styled from "styled-components";
|
||||
import { getUriWithOrg } from "@services/config";
|
||||
import { getUriWithOrg } from "@services/config/config";
|
||||
|
||||
function Lecture(props: any) {
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { ToolbarButtons } from "./Toolbar/ToolbarButtons";
|
|||
import { motion, AnimatePresence } from "framer-motion";
|
||||
import Image from "next/legacy/image";
|
||||
import styled from "styled-components";
|
||||
import { getBackendUrl } from "../../services/config";
|
||||
import { getBackendUrl } from "@services/config/config";
|
||||
import { SlashIcon } from "@radix-ui/react-icons";
|
||||
import Avvvatars from "avvvatars-react";
|
||||
// extensions
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import React from "react";
|
|||
import styled from "styled-components";
|
||||
import { AlertCircle, AlertTriangle, Image, ImagePlus, Info } from "lucide-react";
|
||||
import { getImageFile, uploadNewImageFile } from "../../../../services/blocks/Image/images";
|
||||
import { getBackendUrl } from "../../../../services/config";
|
||||
import { getBackendUrl } from "../../../../services/config/config";
|
||||
|
||||
function ImageBlockComponent(props: any) {
|
||||
const [image, setImage] = React.useState(null);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import React from "react";
|
|||
import styled from "styled-components";
|
||||
import { AlertCircle, AlertTriangle, FileText, Image, ImagePlus, Info } from "lucide-react";
|
||||
import { getPDFFile, uploadNewPDFFile } from "../../../../services/blocks/Pdf/pdf";
|
||||
import { getBackendUrl } from "../../../../services/config";
|
||||
import { getBackendUrl } from "../../../../services/config/config";
|
||||
|
||||
function PDFBlockComponent(props: any) {
|
||||
const [pdf, setPDF] = React.useState(null);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { NodeViewWrapper } from "@tiptap/react";
|
|||
import { AlertTriangle, Image, Video } from "lucide-react";
|
||||
import React from "react";
|
||||
import styled from "styled-components";
|
||||
import { getBackendUrl } from "../../../../services/config";
|
||||
import { getBackendUrl } from "../../../../services/config/config";
|
||||
import { uploadNewVideoFile } from "../../../../services/blocks/Video/video";
|
||||
|
||||
function VideoBlockComponents(props: any) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getBackendUrl } from "@services/config";
|
||||
import { getBackendUrl } from "@services/config/config";
|
||||
import React from "react";
|
||||
import styled from "styled-components";
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import Link from "next/link";
|
|||
import Image from "next/image";
|
||||
import { useRouter, useSearchParams, usePathname } from "next/navigation";
|
||||
import { headers } from "next/headers";
|
||||
import { getOrgFromUri, getUriWithOrg } from "@services/config";
|
||||
import { getOrgFromUri, getUriWithOrg } from "@services/config/config";
|
||||
|
||||
export const Menu = (params : any) => {
|
||||
const router = useRouter();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
|
||||
interface LoginAndGetTokenResponse {
|
||||
access_token: "string";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
export async function uploadNewImageFile(file: any, lecture_id: string) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
export async function uploadNewPDFFile(file: any, lecture_id: string) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
export async function uploadNewVideoFile(file: any, lecture_id: string) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { RequestBody } from "@services/utils/requests";
|
||||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
|
||||
/*
|
||||
This file includes only POST, PUT, DELETE requests
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { initialData } from "../../components/Drags/data";
|
||||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody } from "@services/utils/requests";
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { getAPIUrl } from "./config";
|
||||
import { RequestBody } from "./utils/requests";
|
||||
import { getAPIUrl } from "../config/config";
|
||||
import { RequestBody } from "../utils/requests";
|
||||
|
||||
/*
|
||||
This file includes only POST, PUT, DELETE requests
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
export async function createLecture(data: any, chapter_id: any, org_id: any) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { RequestBody } from "./utils/requests";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody } from "../utils/requests";
|
||||
|
||||
/*
|
||||
This file includes only POST, PUT, DELETE requests
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody } from "@services/utils/requests";
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody } from "@services/utils/requests";
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getAPIUrl } from "@services/config";
|
||||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody } from "@services/utils/requests";
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue