reorganize project

This commit is contained in:
hippoz 2021-02-18 20:57:54 +02:00
parent 1b425dc274
commit dc08d02dc8
No known key found for this signature in database
GPG key ID: 7C52899193467641
17 changed files with 29 additions and 29 deletions

View file

@ -1,4 +1,4 @@
import config from './Config'; import config from '../Config';
async function APIRequest(endpoint, options) { async function APIRequest(endpoint, options) {
let res; let res;

View file

@ -1,6 +1,6 @@
import APIRequest from './APIRequest'; import APIRequest from './APIRequest';
import gatewayConnection from './Gateway/globalGatewayConnection'; import gatewayConnection from '../API/Gateway/globalGatewayConnection';
import Logger from './Logger'; import Logger from '../Util/Logger';
const { log: authLog, error: authError } = Logger([ 'Authenticator' ]); const { log: authLog, error: authError } = Logger([ 'Authenticator' ]);
@ -9,7 +9,7 @@ const Authenticator = {
authLog('Fetching current logged in user status...'); authLog('Fetching current logged in user status...');
const { json, isOK, err } = await APIRequest.authenticated('/api/v1/users/current/info'); const { json, isOK, err } = await APIRequest.authenticated('/api/v1/users/current/info');
if (!isOK && err) { if (!isOK && err) {
authLog('Exeption while fetching current logged in user status', err); authLog('Exception while fetching current logged in user status', err);
throw new Error(err); throw new Error(err);
} }
if (!isOK && !err) { if (!isOK && !err) {
@ -21,7 +21,7 @@ const Authenticator = {
return undefined; return undefined;
} }
authLog(`Logged in as "${json.user.username || '[undefined user]'}"`); authLog(`Logged in as "${json.user.username || '[undefined username]'}"`);
// NOTE(hippoz): this function has a stupid side-effect but this will have to do for now... // NOTE(hippoz): this function has a stupid side-effect but this will have to do for now...
gatewayConnection.connect(json.user.token); gatewayConnection.connect(json.user.token);

View file

@ -1,6 +1,6 @@
import io from 'socket.io-client'; import io from 'socket.io-client';
import Logger from '../Logger'; import Logger from '../../Util/Logger';
const { log: gatewayLog } = Logger([ 'Gateway' ]); const { log: gatewayLog } = Logger([ 'Gateway' ]);
const { log: gatewayHandshakeLog } = Logger([ 'Gateway', 'Handshake' ]); const { log: gatewayHandshakeLog } = Logger([ 'Gateway', 'Handshake' ]);

View file

@ -1,6 +1,6 @@
import GatewayConnection from './GatewayConnection'; import GatewayConnection from './GatewayConnection';
import config from '../Config'; import config from '../../Config';
import store from '../store'; import store from '../../Global/store';
const globalGatewayConnection = new GatewayConnection(config.gatewayUrl); const globalGatewayConnection = new GatewayConnection(config.gatewayUrl);

View file

@ -2,10 +2,10 @@ import { useState } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import Notification from '../Notification'; import Notification from '../UI/Notification';
import APIRequest from '../../APIRequest'; import APIRequest from '../../API/APIRequest';
import Authenticator from './../../Authenticator'; import Authenticator from '../../API/Authenticator';
import { getLoginMessageFromError } from '../../Errors' import { getLoginMessageFromError } from '../../Util/Errors'
export default function Login() { export default function Login() {
const history = useHistory(); const history = useHistory();

View file

@ -1,5 +1,5 @@
import CategoryProfile from './CategoryProfileLink'; import CategoryProfile from './CategoryProfileLink';
import gatewayConnection from '../../Gateway/globalGatewayConnection'; import gatewayConnection from '../../API/Gateway/globalGatewayConnection';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';

View file

@ -1,12 +1,12 @@
import CategoryListLoader from './CategoryListLoader'; import CategoryListLoader from './CategoryListLoader';
import CategoryButton from './CategoryButton'; import CategoryButton from './CategoryButton';
import APIRequest from '../../APIRequest'; import APIRequest from '../../API/APIRequest';
import { couldNotReach } from '../../Errors'; import { couldNotReach } from '../../Util/Errors';
import { connect, useDispatch } from 'react-redux' import { connect, useDispatch } from 'react-redux'
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import Logger from '../../Logger'; import Logger from '../../Util/Logger';
import gatewayConnection from '../../Gateway/globalGatewayConnection'; import gatewayConnection from '../../API/Gateway/globalGatewayConnection';
const { log: loaderLog } = Logger([ 'CategoryList', 'Loader' ]); const { log: loaderLog } = Logger([ 'CategoryList', 'Loader' ]);

View file

@ -1,7 +1,7 @@
import CategoryViewLoader from './CategoryViewLoader'; import CategoryViewLoader from './CategoryViewLoader';
import CategoryProfile from './CategoryProfileLink'; import CategoryProfile from './CategoryProfileLink';
import Message from '../Messages/Message'; import Message from '../Messages/Message';
import gatewayConnection from '../../Gateway/globalGatewayConnection'; import gatewayConnection from '../../API/Gateway/globalGatewayConnection';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { connect, useDispatch } from 'react-redux'; import { connect, useDispatch } from 'react-redux';

View file

@ -1,11 +1,11 @@
import Login from './Auth/Login'; import Login from '../Auth/Login';
import Root from './Root'; import Root from '../Home/Root';
import Authenticator from './../Authenticator'; import Authenticator from '../../API/Authenticator';
import Notification from './Notification'; import Notification from '../UI/Notification';
import './../Styles/App.scss'; import './../../Styles/App.scss';
import { couldNotReach } from '../Errors'; import { couldNotReach } from '../../Util/Errors';
import CategoryView from './Categories/CategoryView'; import CategoryView from '../Categories/CategoryView';
import Sidebar from './UI/Sidebar'; import Sidebar from '../UI/Sidebar';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useDispatch, connect } from 'react-redux' import { useDispatch, connect } from 'react-redux'

View file

@ -1,4 +1,4 @@
import defaultProfile from '../../Images/defaultprofile_256px-256px.png' import defaultProfile from '../../Content/Images/defaultprofile_256px-256px.png'
export default function ProfileLink({ object, size=32, type, offset=true, children=null }) { export default function ProfileLink({ object, size=32, type, offset=true, children=null }) {
let picture; let picture;

View file

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 645 B

View file

@ -1,5 +1,5 @@
import store from './store'; import store from './Global/store';
import App from './Components/App'; import App from './Components/Main/App';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';