sanger96 / Happenings_Team-5_UTD_Senior_Design_Project

UTD Senior Design Project; Group Members: Gaurav Sanger, Jonathan Lam, Robert Dohm, Landin Kasti, Charles Eaton
3 stars 0 forks source link

[Front-end] Create a global useraccount class variable #107

Open rwdohm83 opened 3 months ago

rwdohm83 commented 3 months ago

Beginning work on this.

rwdohm83 commented 3 months ago

I created a class called GlobalVars that will hold all of our Global data.

public class GlobalVars extends Application { int userID = -1; String username = ""; String password = "";

private static final GlobalVars ourInstance = new GlobalVars();
public static GlobalVars getInstance() {
    return ourInstance;
}

public void setUserID(int id){ this.userID = id; }
public int getUserID(){ return userID; }
public void setUsername(String username){ this.username = username; }
public String getUsername(){ return username; }
public void setPassword(String password){ this.password = password; }
public String getPassword(){ return password; }

}

You can get an instance of it anywhere in the app by using: com.example.happeningsapp.GlobalVars gVars = com.example.happeningsapp.GlobalVars.getInstance();

sanger96 commented 3 months ago

set email and password, need way to get account id.

sanger96 commented 3 months ago

I set it from the login page to take place when the user logs in.

rwdohm83 commented 3 months ago

I pulled your branch and edited one thing so that it saves the accountID in GlobalVars. Landin updated the endpoint to return the accountID if the login in successful. It was a small fix, but works great. Pushed to front end.

I am keeping this issue open so people may log what variables they add to GlobalVars.

sanger96 commented 3 months ago

I added a timeWindow (hours) here. This is used to set the times within which we want events to be shown on the map. I think the ability to change the time window could be on a separate page so I added it here.