diff --git a/src/components/app.js b/src/components/app.js
index 782183b..1580a56 100644
--- a/src/components/app.js
+++ b/src/components/app.js
@@ -10,13 +10,13 @@ class App extends React.Component {
this.authenticationService = new AuthenticationService();
}
-
+
render() {
if (this.authenticationService.isAuthenticated()) {
return (
diff --git a/src/services/authenticationService.js b/src/services/authenticationService.js
index 46e63b6..d9132b4 100644
--- a/src/services/authenticationService.js
+++ b/src/services/authenticationService.js
@@ -2,10 +2,10 @@ import comObj from "./communicationService";
import { redirect } from "../components/redirect";
class AuthenticationService {
constructor() {
-
+
this.bindThisAndThats();
}
- bindThisAndThats(){
+ bindThisAndThats() {
this.login = this.login.bind(this);
this.register = this.register.bind(this);
this.successLogin = this.successLogin.bind(this);
@@ -14,7 +14,7 @@ class AuthenticationService {
successLogin(a) {
comObj.setID(a.sessionId);
console.log(a);
- // redirect("/");
+ redirect("/");
}
failLogin(a) {
console.log("Sranje si!");
@@ -23,15 +23,15 @@ class AuthenticationService {
login(dataObj) {
if (comObj.getID()) { alert("Vec postoji ulogovan korisnik"); return; }
comObj.post("login", dataObj, this.successLogin, this.failLogin);
-
+
}
- successRegister(a){
+ successRegister(a) {
redirect("/");
-
+
}
- failRegister(error){
+ failRegister(error) {
console.log(error.response.data.error.message);
-
+
}
register(dataObj, callbackFail) {
comObj.post("register", dataObj, this.succesRegister, callbackFail);
diff --git a/src/services/dataService.js b/src/services/dataService.js
index 10d3f45..7f68410 100644
--- a/src/services/dataService.js
+++ b/src/services/dataService.js
@@ -1,6 +1,15 @@
import comObj from "./communicationService";
+import ProfileDTO from "./profileDTO";
class DataService {
constructor(){
}
-}
\ No newline at end of file
+
+ getProfile(callback, failCallback){
+ comObj.get("profile", a=> callback(new ProfileDTO(a)), a=> failCallback(a));
+ }
+}
+
+const dataObj = new DataService();
+
+export default dataObj;
\ No newline at end of file
diff --git a/src/services/dataServiceDTO.js b/src/services/profileDTO.js
similarity index 100%
rename from src/services/dataServiceDTO.js
rename to src/services/profileDTO.js