Skip to content

Commit

Permalink
Merge branch 'dev-dataaccess' into dev-friends
Browse files Browse the repository at this point in the history
# Conflicts:
#	webapp/src/App.js
#	webapp/src/handlers/podAccess.js
  • Loading branch information
Manuhcuartas committed Mar 30, 2023
2 parents 650ab62 + d80fff5 commit b419574
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 2 deletions.
31 changes: 31 additions & 0 deletions webapp/src/handlers/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {SessionManager} from "./sessionManager";

class Controller{
sessionMng;
constructor() {
this.sessionMng = new SessionManager();
this.user = new User();
}

/**
* This method handles the session
* @param isLoggedInValue
* @returns {Controller}
*/
sessionHandler(){
this.sessionMng.sessionState();
return this;
}

getSessionState(){
return this.sessionMng.isLoggedIn;
}

getSession(){
return this.sessionMng.session;
}
}

export{
Controller,
}
35 changes: 35 additions & 0 deletions webapp/src/handlers/sessionManager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {useSession} from "@inrupt/solid-ui-react";
import {checkForLomap} from "./podHandler";
import * as sessionMetho from "@inrupt/solid-client-authn-browser";
import {User} from "../models/user";

class SessionManager{
//With this we can control the login status for solid
//session;
session = sessionMetho;
isLoggedIn = false;
user
constructor() {
//this.session = useSession();
this.session.getDefaultSession()
//this.session = sessionMetho.getDefaultSession();
}

sessionState() {
//We have logged in
this.session.onLogin(async () => {
let pod = await checkForLomap(this.session);
this.user.setPodURL(pod);
this.isLoggedIn = true;

});
//We have logged out
this.session.onLogout(() => {
this.isLoggedIn = false;
})
}
}

export {
SessionManager,
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import {
CoordinatesInvalidFormatException,
StringInvalidFormatException
} from '../util/Exceptions/Exceptions.js';
} from '../util/Exceptions/exceptions.js';

/**
* Location LoMap class
Expand Down
File renamed without changes.
6 changes: 5 additions & 1 deletion webapp/src/models/User.js → webapp/src/models/user.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {LocationLM} from "./Location";
import {LocationLM} from "./location";
/**
* User LoMap class
*/
Expand Down Expand Up @@ -71,6 +71,10 @@ class User{
}
}
}

setPodURL(pod){
this.podURL = pod;
}
}

export {User};
File renamed without changes.

0 comments on commit b419574

Please sign in to comment.