From b48114b8bb07a048f0228317caee10c2a4a11b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Mur=C3=A7a?= Date: Tue, 29 Nov 2022 11:41:23 -0300 Subject: [PATCH] Rename and move files --- src/context/auth.js | 2 +- src/context/user.js | 2 +- src/services/{professor-service.js => professor.js} | 0 src/services/{user-service-provider.js => provider.js} | 4 ++-- src/services/{student-service.js => student.js} | 2 +- src/{services/user-service.js => utils/mocks/api.js} | 4 ++-- src/{services/mocks.js => utils/mocks/responses.js} | 0 7 files changed, 7 insertions(+), 7 deletions(-) rename src/services/{professor-service.js => professor.js} (100%) rename src/services/{user-service-provider.js => provider.js} (79%) rename src/services/{student-service.js => student.js} (96%) rename src/{services/user-service.js => utils/mocks/api.js} (98%) rename src/{services/mocks.js => utils/mocks/responses.js} (100%) diff --git a/src/context/auth.js b/src/context/auth.js index fd5104b..3cf7d40 100644 --- a/src/context/auth.js +++ b/src/context/auth.js @@ -1,5 +1,5 @@ import { createContext, useContext, useEffect, useState } from 'react'; -import { getUser, registerUser } from '../services/user-service'; +import { getUser, registerUser } from '../utils/mocks/api'; const AuthContext = createContext(); diff --git a/src/context/user.js b/src/context/user.js index afb4527..4225201 100644 --- a/src/context/user.js +++ b/src/context/user.js @@ -1,6 +1,6 @@ import { createContext, useContext, useEffect, useState } from 'react'; import { useLocation } from 'react-router-dom'; -import { UserServiceProvider } from '../services/user-service-provider'; +import { UserServiceProvider } from '../services/provider'; import { useAuthState } from './auth'; const UserContext = createContext(); diff --git a/src/services/professor-service.js b/src/services/professor.js similarity index 100% rename from src/services/professor-service.js rename to src/services/professor.js diff --git a/src/services/user-service-provider.js b/src/services/provider.js similarity index 79% rename from src/services/user-service-provider.js rename to src/services/provider.js index 31f51cf..30ddf81 100644 --- a/src/services/user-service-provider.js +++ b/src/services/provider.js @@ -4,13 +4,13 @@ export const UserServiceProvider = (function () { async function createInstance(user) { switch (user.role) { case 'STUDENT': - const studentService = await import('../services/student-service'); + const studentService = await import('./student'); if (studentService) { return new studentService.default(user); } break; case 'PROFESSOR': - const professorService = await import('../services/professor-service'); + const professorService = await import('./professor'); if (professorService) { return new professorService.default(user); } diff --git a/src/services/student-service.js b/src/services/student.js similarity index 96% rename from src/services/student-service.js rename to src/services/student.js index 5b9f297..1fcd107 100644 --- a/src/services/student-service.js +++ b/src/services/student.js @@ -8,7 +8,7 @@ import { getFaq, getPeopleByClassId, getUpcomingAssignmentsByClassId, -} from './user-service'; +} from '../utils/mocks/api'; export default class StudentService { constructor(user) { diff --git a/src/services/user-service.js b/src/utils/mocks/api.js similarity index 98% rename from src/services/user-service.js rename to src/utils/mocks/api.js index 0f0fb92..8735207 100644 --- a/src/services/user-service.js +++ b/src/utils/mocks/api.js @@ -1,4 +1,4 @@ -import { sleep } from '../utils/sleep'; +import { sleep } from '../sleep'; import { allClassrooms, allAssignments, @@ -9,7 +9,7 @@ import { allClassroomAnnouncements, allUpcomingAssignments, allPeople, -} from './mocks'; +} from './responses'; const getClassrooms = userId => sleep(300).then(() => { diff --git a/src/services/mocks.js b/src/utils/mocks/responses.js similarity index 100% rename from src/services/mocks.js rename to src/utils/mocks/responses.js