diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/src/components/app.js b/src/components/app.js index 688ddcc..8853ff4 100644 --- a/src/components/app.js +++ b/src/components/app.js @@ -1,14 +1,26 @@ import React from "react"; -import HelloWorld from "./helloWorld/helloWorld"; +import { Switch, Route } from "react-router-dom"; +import LoginPage from "./login-page/login-page"; +import MainPage from "./mainPage"; +// import AuthenticationService from '../services/authenticationService'; class App extends React.Component { constructor(props) { super(props); + + // this.isAuth = new AuthenticationService().isAuthenticated(); } + render() { - return ; + // this.isAuth ? : + return ( + +
+ +
+ ); } } diff --git a/src/components/common/header.js b/src/components/common/header.js new file mode 100644 index 0000000..c7ff564 --- /dev/null +++ b/src/components/common/header.js @@ -0,0 +1,19 @@ +import React, { Component } from "react"; + +class Header extends Component { + render() { + return ( +
+ +
+ ); + } +} + +export default Header; \ No newline at end of file diff --git a/src/components/helloWorld/helloWorld.js b/src/components/helloWorld/helloWorld.js deleted file mode 100644 index c0ba8a7..0000000 --- a/src/components/helloWorld/helloWorld.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from "react"; - -class HelloWorld extends React.Component { - constructor(props) { - super(props); - } - - render() { - return

Hello World!

; - } -} - -export default HelloWorld; diff --git a/src/components/login-page/login-page.js b/src/components/login-page/login-page.js new file mode 100644 index 0000000..d3e7e35 --- /dev/null +++ b/src/components/login-page/login-page.js @@ -0,0 +1,28 @@ +import React from "react"; +import Welcome from "./welcome"; +import Login from "./login"; +import Register from "./register"; + +import { Switch, Route } from "react-router-dom"; + +class LoginPage extends React.Component { + constructor(props) { + super(props); + } + + render() { + return ( +
+ + + + + + +
+ + ); + } +} + +export default LoginPage; diff --git a/src/components/login-page/login.js b/src/components/login-page/login.js new file mode 100644 index 0000000..f3cab3b --- /dev/null +++ b/src/components/login-page/login.js @@ -0,0 +1,34 @@ +import React from "react"; +import { Link } from "react-router-dom"; + +class Login extends React.Component { + constructor(props){ + super(props); + } + + render(){ + + return( +
+
+

Login

+

Register

+
+
+ email: +
+ + pass: +
+ + +
+ +
+ +
+ ); + } +} + +export default Login; \ No newline at end of file diff --git a/src/components/login-page/register.js b/src/components/login-page/register.js new file mode 100644 index 0000000..aa989e2 --- /dev/null +++ b/src/components/login-page/register.js @@ -0,0 +1,34 @@ +import React from "react"; +import { Link } from "react-router-dom"; + +class Register extends React.Component { + constructor(props) { + super(props); + } + + render() { + + return ( +
+
+

Login

+

Register

+
+
+ Name: + + email: + + pass: + + +
+ +
+ +
+ ); + } +} + +export default Register; diff --git a/src/components/login-page/welcome.js b/src/components/login-page/welcome.js new file mode 100644 index 0000000..a6d6d65 --- /dev/null +++ b/src/components/login-page/welcome.js @@ -0,0 +1,18 @@ +import React from "react"; + +const Welcome = () => { + + + return ( +
+

+ Welcome to BitBook +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam consequat dignissim luctus. Sed eu rutrum purus. Morbi augue arcu, blandit nec ante sed, finibus tempor ex. Aenean vel arcu a eros fringilla facilisis in in lectus. Nam at ex posuere, pretium neque vel, tempor velit. Maecenas eget justo nec leo aliquet mollis. Sed ac luctus ipsum. Pellentesque tincidunt mauris urna. Morbi vitae tortor maximus, dignissim neque ut, mollis ipsum. Morbi nisl nibh, elementum non velit ut, sollicitudin consectetur eros. Quisque ac leo auctor, vehicula tellus sed, varius nulla. Aliquam ornare interdum consequat. In tincidunt ex a sagittis congue. Phasellus lacinia sit amet magna sit amet efficitur. Vivamus lobortis sem a bibendum iaculis. Fusce ut imperdiet justo. +

+
+ ); +}; + +export default Welcome; \ No newline at end of file diff --git a/src/components/mainPage.js b/src/components/mainPage.js new file mode 100644 index 0000000..5922ddd --- /dev/null +++ b/src/components/mainPage.js @@ -0,0 +1,20 @@ +import React, { Component } from "react"; +import Header from "./common/header"; + + +class MainPage extends Component { + constructor(props) { + super(props); + } + + render() { + return ( +
+
+
Dobrodosli na main
+
+ ); + } +} + +export default MainPage; \ No newline at end of file diff --git a/src/constants.js b/src/constants.js index ca54aec..cbb26ea 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1 +1,5 @@ -// export const SOME_GLOBAL_CONFIG = "value"; \ No newline at end of file +// export const SOME_GLOBAL_CONFIG = "value"; + +export const API_KEY = "jTAAZCA5"; +export const SESSION_STORAGE_KEY = "SESSION_ID"; +export const BASE_URL = ""; \ No newline at end of file diff --git a/src/index.html b/src/index.html index ac437dd..32255ab 100644 --- a/src/index.html +++ b/src/index.html @@ -4,12 +4,15 @@ - + + + My React App
- + + diff --git a/src/index.js b/src/index.js index 80d7d1b..7cb4896 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,13 @@ import React from "react"; import ReactDOM from "react-dom"; -import { BrowserRouter } from "react-router-dom"; +import { HashRouter } from "react-router-dom"; import "babel-polyfill"; import App from "./components/app"; ReactDOM.render( - + - , + , document.querySelector(".container") ); diff --git a/src/services/fetchService.js b/src/services/fetchService.js new file mode 100644 index 0000000..e7fe4b8 --- /dev/null +++ b/src/services/fetchService.js @@ -0,0 +1,47 @@ +import fetch from "fetch"; +import { SESSION_STORAGE_KEY, API_KEY, BASE_URL } from "../../constants"; + +export default class FetchService { + + headers() { + + let sessionId = sessionStorage.getItem(SESSION_STORAGE_KEY); + if (sessionId) { + + return { + "Content-Type": "application/json", + "SessionId": sessionId, + "API": API_KEY + }; + } + + return { + "Content-Type": "application/json", + "API": API_KEY + }; + } + + get(url, successHandler, errorHandler) { + + fetch(`${BASE_URL}${url}`, { + method: "GET", + headers: this.headers() + }) + .then(response => response.json()) + .then(jsonData => successHandler(jsonData)) + .catch(error => errorHandler(error)); + } + + post(url, postData) { + + fetch(`${BASE_URL}${url}`, { + method: "POST", + body: JSON.stringify(postData), + headers: this.headers() + }) + .then(response => response.json()) + .then(jsonData => console.log(jsonData)) + .catch(error => console.log(error)); + } + +} \ No newline at end of file diff --git a/src/services/redirectService.js b/src/services/redirectService.js new file mode 100644 index 0000000..5ffb880 --- /dev/null +++ b/src/services/redirectService.js @@ -0,0 +1,7 @@ +export default class RedirectService { + + goTo(path) { + window.location.assign(`#/${path}`); + // this.props.history.push(`/${path}`); + } +}; \ No newline at end of file