Skip to content

Commit

Permalink
Fix: Now makes a authToken to be passed around controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBalunan committed Apr 16, 2026
1 parent 1c798f9 commit af55452
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,35 @@

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import ntnu.systemutvikling.team6.controller.components.BaseController;
import ntnu.systemutvikling.team6.database.DAO.UserDAO;
import ntnu.systemutvikling.team6.database.DatabaseConnection;
import ntnu.systemutvikling.team6.database.DatabaseSetup;
import ntnu.systemutvikling.team6.database.Readers.UserSelect;
import ntnu.systemutvikling.team6.models.Charity;
import ntnu.systemutvikling.team6.models.registry.CharityRegistry;
import ntnu.systemutvikling.team6.scraper.scraperComponents.APICharityScraper;
import ntnu.systemutvikling.team6.service.APIToDatabaseService;
import ntnu.systemutvikling.team6.service.AuthenticationService;

public class HmHApplication extends Application {
@Override
public void start(Stage stage) throws Exception {
DatabaseConnection conn = new DatabaseConnection();
AuthenticationService authToken = new AuthenticationService(new UserSelect(conn), new UserDAO(conn));

FXMLLoader fxmlLoader =
new FXMLLoader(HmHApplication.class.getResource("/fxml/frontPage.fxml"));
Scene scene = new Scene(fxmlLoader.load());


BaseController controller = fxmlLoader.getController();
controller.setAuthToken(authToken);

Image icon =
new Image(
Objects.requireNonNull(HmHApplication.class.getResource("/images/Logo.png"))
Expand All @@ -48,6 +61,7 @@ public void init() {
e.printStackTrace();
}
/* Test and get data from Innsamlingkontrollen API */
/*
try {
HttpClient https = HttpClient.newHttpClient();
APICharityScraper scraper = new APICharityScraper(https);
Expand All @@ -66,6 +80,8 @@ public void init() {
e.printStackTrace();
}
System.out.println("-- \n Init complete \n --");
*/
}

public static void main(String[] args) {
Expand Down

0 comments on commit af55452

Please sign in to comment.