Skip to content
Snippets Groups Projects
Commit 6d36eb31 authored by Orlando Piñero's avatar Orlando Piñero
Browse files

connected to backend

parent da1b3d80
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@
"react-redux": "^8.0.5",
"react-scripts": "5.0.1",
"redux": "^4.2.0",
"redux-thunk": "^2.4.2",
"web-vitals": "^2.1.4"
}
},
......@@ -14572,6 +14573,14 @@
"@babel/runtime": "^7.9.2"
}
},
"node_modules/redux-thunk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.4.2.tgz",
"integrity": "sha512-+P3TjtnP0k/FEjcBL5FZpoovtvrTNT/UXd4/sluaSyrURlSlhLSzEdfsTBW7WsKB6yPvgd7q/iZPICFjW4o57Q==",
"peerDependencies": {
"redux": "^4"
}
},
"node_modules/regenerate": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
......
......@@ -13,6 +13,7 @@
"react-redux": "^8.0.5",
"react-scripts": "5.0.1",
"redux": "^4.2.0",
"redux-thunk": "^2.4.2",
"web-vitals": "^2.1.4"
},
"scripts": {
......
import React from 'react';
import React, { Component } from 'react';
import './App.css';
import TopMenu from './components/TopMenu';
// import PublicPage from './components/PublicPage';
import BlankPage from './components/blankPage';
import PublicPage from './components/PublicPage';
import PrivatePage from './components/PrivatePage';
import { connect } from 'react-redux';
function App() {
return (
<div className="App">
<TopMenu />
<BlankPage />
</div>
);
const mapStateToProps = state => {
return state
}
export default App;
class App extends Component {
render() {
const user = this.props.user
let workspace;
if (user) {
workspace = <PrivatePage />
} else {
workspace = <PublicPage />
}
return (
<div className="App">
<TopMenu />
{workspace}
</div>
);
}
}
export default connect(mapStateToProps)(App);
export const SHOW_LOGIN_DIALOG = 'SHOW_LOGIN_DIALOG';
export const HIDE_LOGIN_DIALOG = 'HIDE_LOGIN_DIALOG';
export const AUTHENTICATION_PENDING = 'AUTHENTICATION_PENDING'
export const AUTHENTICATION_SUCCESS = 'AUTHENTICATION_SUCCESS'
export const AUTHENTICATION_ERROR = 'AUTHENTICATION_ERROR'
export function getShowLoginDialogAction() {
return {
type: SHOW_LOGIN_DIALOG
}
}
export function getHideLoginDialogAction() {
return {
type: HIDE_LOGIN_DIALOG
}
}
export function getAuthenticationPendingAction() {
return {
type: AUTHENTICATION_PENDING
}
}
export function getAuthenticationSuccessAction(userSession) {
return {
type: AUTHENTICATION_SUCCESS,
user: userSession.user,
accessToken: userSession.accessToken
}
}
export function getAuthenticationErrorAction(error) {
return {
type: AUTHENTICATION_ERROR,
error: error
}
}
export function authenticateUser(userID, password) {
console.log("Authenticate")
return dispatch => {
dispatch(getAuthenticationPendingAction());
login(userID, password)
.then(
userSession => {
const action = getAuthenticationSuccessAction(userSession);
dispatch(action);
},
error => {
dispatch(getAuthenticationErrorAction(error));
}
)
.catch(error => {
dispatch(getAuthenticationErrorAction(error))
})
}
}
function login(userID, password) {
const requestOptions = {
method: 'GET',
headers: { 'Authorization': 'Basic ' + btoa(userID + ":" + password) }
};
console.log(userID)
console.log(password)
return fetch('https://localhost/api/authenticate', requestOptions)
.then(handleResponse)
.then(userSession => {
return userSession
});
}
function handleResponse(response) {
const authorizationHeader = response.headers.get('Authorization');
return response.text().then(text => {
console.log('Receive result: ' + authorizationHeader)
const data = text && JSON.parse(text);
var token
if (authorizationHeader) {
token = authorizationHeader.split(" ")[1];
}
if (!response.ok) {
if (response.status === 401) {
logout();
}
const error = (data && data.message) || response.statusText;
return Promise.reject(error);
} else {
let userSession = {
user: data,
accessToken: token
}
return userSession
}
});
}
function logout() {
console.error('Should irgendas')
}
\ No newline at end of file
import React, { Component } from "react";
import LoginButton from "./loginButton";
class blankPage extends Component {
class PrivatePage extends Component {
render() {
return (
<div>
<LoginButton />
<h1>PSSSST thats private!</h1>
</div>
)
}
}
export default blankPage
\ No newline at end of file
export default PrivatePage
\ No newline at end of file
import React, { Component } from "react";
import LoginButton from "./loginButton";
class PublicPage extends Component {
render() {
return (
<div>
<head>
<meta charset="utf-8" />
<title>Startseite: BHT Berlin</title>
<meta name="generator" content="TYPO3 CMS" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="index,follow" />
<meta name="description" content="Studiere Zukunft: Die staatliche Berliner Hochschule für Technik (BHT) bietet über 70 Studiengänge in den angewandten Ingenieur-, Natur- und Wirtschaftswissenschaften." />
<meta name="keywords" content="Beuth,Hochschule,BHT,BHTB,Fachhochschule,Berlin,Studium,Forschung,Technik,TFH, Technische Fachhochschule Berlin, Berlin-Wedding, Ingenieurwissenschaften, Naturwissenschaften, Wirtschaftswissenschaften, Studieren, Bachelor, Master" />
<link rel="stylesheet" type="text/css" href="/typo3conf/ext/hdb/Resources/Public/Css/style.css?1554138479" media="all" />
<link rel="stylesheet" type="text/css" href="/typo3temp/assets/compressed/merged-6bb1364797fc71937f4a4d057c9767f0-0970230cbfe33acfcbab940914127793.css?1670417968" media="all" />
<script src="/typo3temp/assets/compressed/merged-0f1b354c11bff5cc2f0d405cba4b051d-d6974f58829b648d050584e3aa003b89.js?1629381060" type="text/javascript"></script>
<link rel="canonical" href="https://www.bht-berlin.de/" />
<link rel="apple-touch-icon" href="/fileadmin/tmpl/apple-touch-icon.png" /><meta property="og:image" content="https://www.bht-berlin.de/configuration/Resources/Public/assets/images/BHT_Logo_og.png" />
</head>
<body id="top" class="startseite page-3001">
<div id="page" class="startseite">
<div class="noscreen printlogo">
<img src="/configuration/Resources/Public/assets/images/BHT_Logo_print.png" alt="" class="printlogo" />
</div>
<header id="header">
<div id="openCampus">
<nav id="servicemenu" class="hide-for-small">
<a class="invisible" href="#skipNavigation1">Navigation überspringen</a>
<div class="row">
<div class="col-md-5">
<ul>
<li>
<a title="Schnellzugriff" class="open-1 header-link" href="#header" data-tab-content-url="/index.php?id=3001&type=2343">Schnellzugriff</a>
<a title="Schnellzugriff" class="close-1" href="#">Schnellzugriff</a>
</li> <li>
<a title="Informationen für …" class="open-3 openCampus-link" href="#openCampus" data-tab-content-url="/index.php?id=3001&type=2342">Informationen für </a>
<a title="Informationen für …" class="close-3" href="#">Informationen für </a>
</li>
</ul>
</div>
<div class="col-md-3">
<form name="f1" id="f1" title="Volltextsuche" action="/suche"><input type="text" name="q" class="text" placeholder="mit Google™ suchen" autofocus /><input type="hidden" name="ie" value="UTF-8" /></form>
</div>
<div class="col-md-4">
<ul class="right ul_sprachschalter" ><li class="active"><span>DE</span></li><li class="lang"><a href="/en/">EN</a></li><li class="last"><a href="/a-z">A-Z</a></li></ul>
</div>
</div>
<a class="invisible" id="skipNavigation1">&nbsp;</a>
</nav>
<nav id="mobilemenu" class="show-for-small">
<a class="invisible" href="#skipNavigation2">Navigation überspringen</a>
<div class="inside row">
<div class="col-12">
<a title="Men� �ffnen" class="toggle-mmenu-1 open" href="&#35;mmenu-1"><i class="fa fa-bars"></i></a>
<a title="Startseite" class="home" href="/"><i class="fa fa-home"></i></a>
<a title="Suche" class="searchmobile" href="/suche"><i class="fa fa-search"></i></a><ul class="right ul_sprachschalter" ><li class="mobil_sprachschalter active"><span>DE</span></li><li class="mobil_sprachschalter"><a href="/en/">EN</a></li></ul>
</div>
</div>
<a class="invisible" id="skipNavigation2">&nbsp;</a>
</nav>
<div id="fachbereiche-einrichtungen">
<div class="inside">
<div class="mod_article block" id="fachbereiche-einrichtungen-content"></div>
</div>
</div>
<div id="campus">
<div class="inside">
<div id="campus-content" class="mod_article block"></div>
</div>
</div>
</div>
</header>
</div>
<div>
<section class="mod_flexSlider block">
<div class="flex-caption">
</div>
<div class="light">
<div id="slider-startseite" class="flexslider">
<a name="c24472" id="anker24472"></a>
<div id="c24472" class="frame frame-default frame-type-dce_dceuid1 frame-layout-0">
<div class="tx-dce-pi1">
<div id="topSlider" class="flexslider">
<ul class="slides">
<li>
<a href="/weihnachtskarte"><img alt="Die BHT wünscht frohe Festtage" src="/fileadmin/images/startseite/BHT-Webseite_Weihnachten22.png" width="1024" height="320" />
</a>
</li>
<li>
<a href="/magazin">
<img title="BHT. Campus-Magazin 2/2022" alt="BHT. Campus-Magazin 2/2022" src="/fileadmin/_processed_/b/d/csm_header_bht-magazin_2022-2_f1b19f2931.png" width="1024" height="320" />
</a>
</li>
<li>
<a href="https://www.bht-berlin.de/3331/article/8344" target="_blank">
<img title="BHT-Top 5 beliebteste Studiengänge" alt="BHT-Top 5 beliebteste Studiengänge" src="/fileadmin/_processed_/b/9/csm_BHT-Webseite_Top5Studiengaenge2_283bc5feaa.png" width="1024" height="320" />
</a>
</li>
<li>
<a href="https://www.bht-berlin.de/3794" target="_blank">
<img title="Bilder Lange Nacht der Wissenschaften 2022" alt="Bilder Lange Nacht der Wissenschaften 2022" src="/fileadmin/_processed_/c/8/csm_BHT-Webseite-Header_Startseite2_a9b57201f2.png" width="1024" height="320" />
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<div id="container">
<div id="main">
<div class="inside">
<div class="mod_article zielnavbar alpha block" id="zielgruppe">
</div>
<div class="contentBlock">
<div class="row">
<div class="col">
<a name="c19602" id="anker19602"></a>
<div id="c19602" class="frame frame-default frame-type-list frame-layout-0"><div class="news"><div class="row row-eq-height newsBoxen newsBlock">
<div class="col-md-4"><div><a title="Energiekrise: Die BHT spart" href="/3326/article/8562"><div class="newsImageLast"><img class="img-responsive" src="/fileadmin/_processed_/4/a/csm_2022-12-20_BHT-Spart_AdobeStock_193324751_335487e3b6.jpg" width="709" height="473" alt="" /></div></a><div class="teaserTxt" itemscope="itemscope" itemtype="http://schema.org/Article"><h3 itemprop="headline"><a title="Energiekrise: Die BHT spart" href="/3326/article/8562">
Energiekrise: Die BHT spart
</a></h3><p>Die Energiekrise zwingt uns alle zum Handeln. Die Berliner Hochschule für Technik (BHT) steht für Klimaschutz und Nachhaltigkeit und setzt 2022/2023 verantwortungsbewusst einige kurz- und mittelfristigen Maßnahmen um, mit denen gezielt Energie gespart wird. <a title="Energiekrise: Die BHT spart" href="/3326/article/8562">mehr</a></p></div></div></div>
<div class="col-md-4"><div><a title="VDI-Preis für flexibles Konferenzsystem" href="/3326/article/8536"><div class="newsImageLast"><img class="img-responsive" src="/fileadmin/_processed_/4/6/csm_2022-12-08_VDI-Wettbewerb-Ehrung_0313c7ad24.jpg" width="709" height="473" alt="" /></div></a><div class="teaserTxt" itemscope="itemscope" itemtype="http://schema.org/Article"><h3 itemprop="headline"><a title="VDI-Preis für flexibles Konferenzsystem" href="/3326/article/8536">
VDI-Preis für flexibles Konferenzsystem
</a></h3><p>Ein Tool, das die Eventbranche revolutionieren könnte: Im Rahmen seiner Bachelorarbeit erarbeitete BHT-Student Yannick Mick ein System, das hybride Veranstaltungen flexibler gestalten soll und gewann dafür einen Preis des Berlin-Brandenburger VDI-Nachwuchswettbewerbes. <a title="VDI-Preis für flexibles Konferenzsystem" href="/3326/article/8536">mehr</a></p></div></div></div>
<div class="col-md-4"><div><a title="Entspannter durch das Studium" href="/3326/article/8530"><div class="newsImageLast"><img class="img-responsive" src="/fileadmin/_processed_/8/b/csm_2022-12-06_heyjura_e9ff2073de.jpg" width="709" height="473" alt="" /></div></a><div class="teaserTxt" itemscope="itemscope" itemtype="http://schema.org/Article"><h3 itemprop="headline"><a title="Entspannter durch das Studium" href="/3326/article/8530">
Entspannter durch das Studium
</a></h3><p>Kurz und knackig juristische Lerninhalte zusammenstellen und bündeln: Der BHT-Student Jackson Adewale und sein Team wollen mithilfe ihres Startups heyJura die digitale Bildung nachhaltig verändern und Studierende im Jurastudium unterstützen. <a title="Entspannter durch das Studium" href="/3326/article/8530">mehr</a></p></div></div></div></div></div></div>
<a name="c12966" id="anker12966"></a>
<div id="c12966" class="frame frame-default frame-type-text frame-layout-0"><p><a href="/aktuelles" class="btn">Weitere News</a></p></div>
<a name="c31368" id="anker31368"></a><div class="greenBackground">
<div id="c31368" class="frame frame-100 frame-type-gridelements_pi1 frame-layout-0"><div class="row"><div class="col-12"></div></div><div class="row"><div class="col-lg-6"><a name="c31370" id="anker31370"></a><div id="c31370" class="frame frame-default frame-type-image frame-layout-0 frame-space-before-medium"><div class="ce-image ce-center ce-above"><div class="ce-gallery" data-ce-columns="1" data-ce-images="1"><div class="ce-outer"><div class="ce-inner"><div class="galleryRow"><div class="galleryCol"><figure class="image"><a href="/coronavirus" title="Informationen zum Coronavirus"><img class="image-embed-item" title="Informationen zum Coronavirus" src="/fileadmin/images/startseite/bilder/2020-03-13_coronainformation.jpg" width="963" height="642" alt="" /></a></figure></div></div></div></div></div></div></div><a name="c31366" id="anker31366"></a><div id="c31366" class="frame frame-default frame-type-text frame-layout-0"><header><h4 class="">
Covid-19
</h4></header><p>Aktuelle Informationen zum Coronavirus sowie FAQs für Studium, Lehre, Forschung und Verwaltung finden Sie hier:</p><p><a href="/coronavirus/faq-fuer-studierende" title="Coronavirus: FAQ für Studierende" class="internal-link"><i class="fa fa-share-square"></i>&nbsp;FAQ für Studierende</a></p><p><a href="/coronavirus/faq-fuer-lehrende" title="Coronavirus: FAQ für Lehrende" class="internal-link"><i class="fa fa-share-square"></i>&nbsp;</a><a href="/coronavirus/faq-fuer-lehrende" title="Coronavirus: FAQ für Lehrende" class="internal-link">FAQ für Lehrende</a></p><p><a href="/coronavirus/faq-fuer-mitarbeitende" title="Coronavirus: FAQ für Mitarbeitende" class="internal-link"><i class="fa fa-share-square"></i>&nbsp;</a><a href="/coronavirus/faq-fuer-mitarbeitende" title="Coronavirus: FAQ für Mitarbeitende" class="internal-link">FAQ für Mitarbeitende</a></p></div></div><div class="col-lg-6"><a name="c31361" id="anker31361"></a><div id="c31361" class="frame frame-default frame-type-image frame-layout-0 frame-space-before-medium"><div class="ce-image ce-center ce-above"><div class="ce-gallery" data-ce-columns="1" data-ce-images="1"><div class="ce-outer"><div class="ce-inner"><div class="galleryRow"><div class="galleryCol"><figure class="image"><a href="/leitbild" title="BHT Leitbild"><img class="image-embed-item" title="BHT Leitbild" alt="BHT Leitbild" src="/fileadmin/images/startseite/bilder/2022_leitbild-startseite.png" width="963" height="642" /></a></figure></div></div></div></div></div></div></div><a name="c31362" id="anker31362"></a><div id="c31362" class="frame frame-default frame-type-text frame-layout-0"><header><h4 class="">
Unser Leitbild
</h4></header><p>Hochschule gestalten, Vielfalt leben, Zukunft entwickeln – das sind die Kernthemen unseres Leitbildes, welches 2021 neu erarbeitet wurde. Erfahren Sie, wie Studierende, Mitarbeitende und Lehrende das Leitbild leben.</p></div><a name="c31363" id="anker31363"></a><div id="c31363" class="frame frame-default frame-type-text frame-layout-0"><p><a href="/leitbild" class="btn">zum Leitbild</a></p></div></div></div></div>
</div><a name="c12626" id="anker12626"></a>
<div id="c12626" class="frame frame-default frame-type-list frame-layout-0"><header><h3 class="">
Kalender
</h3></header><div class="tx-cal-controller "><div class="list-view owl-cal-carousel owl-theme row">
<div class="vevent col startseite-cal"><div class="dtstart-container-slider">21.12.2022 13:00 Uhr</div>
<div class="summary">
<h2>
<a href="/item/cal/event/detail/2022/12/21/176?cHash=a535cbc022730c9d34bea992b3937f73" title="(Berufs-)Beratung für Studierende und Absolvent*innen" class="url">(Berufs-)Beratung für Studierende und Absolvent*innen</a></h2></div><div><p>Offene Sprechstunde mit Ursula Scheele, Berufsberaterin/Hochschulberatung</p></div></div><div class="vevent col startseite-cal"><div class="dtstart-container-slider">12.01.2023 17:00 Uhr</div><div class="summary"><h2><a href="/item/cal/event/detail/2023/01/12/1604?cHash=d090e7477a94cdebd4be67bc55671c38" title="HealthTEC: Technik trifft Medizin" class="url">HealthTEC: Technik trifft Medizin</a></h2></div><div><p>Forum zum hochschulinternen Austausch im Bereich Gesundheit</p></div></div><div class="vevent col startseite-cal"><div class="dtstart-container-slider">25.01.2023 </div><div class="summary"><h2><a href="/item/cal/event/detail/2023/01/25/1598?cHash=fe244caa692d4f6d935256b903bdbcc1" title="Lunchtalk #14: MINT-VR-Labs Laborübungen im virtuellen Raum Blick in die vernetzte Arbeitswelt der Zukunft" class="url">Lunchtalk #14: MINT-VR-Labs – Laborübungen im virtuellen Raum – Blick in die vernetzte Arbeitswelt der Zukunft</a></h2></div><div><p>Plattform Forschung & Transfer</p></div></div>
<div class="vevent col startseite-cal"><div class="dtstart-container-slider">08.02.2023 - 08.02.2024</div>
<div class="summary"><h2><a href="/item/cal/event/detail/2023/02/08/1599?cHash=0bf9312d39b5f50b19ae6b1890781cf2" title="Lunchtalk #15: KInsekt" class="url">Lunchtalk #15: KInsekt</a></h2></div><div><p>Plattform Forschung & Transfer</p></div></div></div>
<div class="owl-cal-carousel-navigation">
<a class="btn prev">
<i class="fa fa-chevron-left icon-chevron-left icon-white">
</i>
</a>
<a class="btn next">
<i class="fa fa-chevron-right icon-chevron-right icon-white"></i>
</a>
</div>
</div></div>
<a name="c12686" id="anker12686"></a>
<div id="c12686" class="frame frame-default frame-type-text frame-layout-0"><p class="noMargin"><a href="/events" class="btn">Weitere Termine</a></p></div>
</div>
</div>
</div>
<a name="c21" id="anker21"></a>
<div id="c21" class="frame frame-default frame-type-html frame-layout-0"><div class="socialicons"><ul><li><a href="https://www.facebook.com/BHTbln" title="Facebook" target="_blank"><i class="fa fa-facebook-square fa-2x"></i></a></li><li><a href="https://twitter.com/BHT_bln" title="Twitter" target="_blank"><i class="fa fa-twitter fa-2x"></i></a></li><li><a href="https://www.youtube.com/BHTbln" title="YouTube" target="_blank"><i class="fa fa-youtube fa-2x"></i></a></li><li><a href="https://instagram.com/bht_studierezukunft/" title="Instagram" target="_blank"><i class="fa fa-instagram fa-2x"></i></a></li><li><a href="javascript:window.print()" title="Drucken"><i class="fa fa-print fa-2x"></i></a></li></ul></div></div>
</div>
</div>
</div>
<footer id="footer">
<div class="inside">
<nav class="mod_sitemap">
<ul class="row"><li class="submenu fs first col"><a href="/studium">Studium</a><ul class="level_2"><li><a href="/studiengaenge">Studiengänge</a></li><li><a href="/bewerbung">Bewerbung</a></li><li><a href="/40">Vor dem Studium</a></li><li><a href="/398">Studierendenservice</a></li><li><a href="/175">Internationales</a></li><li><a href="/3184">Studienorganisation</a></li></ul></li><li class="col"><a href="/weiterbildung">Weiterbildung</a><ul class="level_2"><li><a href="/fsi">Fernstudieninstitut</a></li><li><a href="/master-fernstudiengaenge">Fernstudiengänge</a></li><li><a href="/weiterbildung-fernstudium">Zertifikatskurse</a></li><li><a href="/weiterbildungsseminare">Präsenzseminare</a></li><li><a href="/fsi-anmeldung">Anmeldung</a></li><li><a href="/foerderung">Fördermöglichkeiten</a></li></ul></li><li class="col"><a href="/forschung">Forschung</a><ul class="level_2"><li><a href="/3117">Forschungsschwerpunkte</a></li><li><a href="/4503">Forschungsverbünde</a></li><li><a href="/3115">Forschungsservice</a></li><li><a href="/forschungstag">Forschungs- und Transfertag</a></li><li><a href="/nwz">Nachwuchsförderung und wissenschaftliche Zusammenarbeit</a></li><li><a href="/promotion">Promotion</a></li><li><a href="/technologietransfer">Technologietransfer</a></li><li><a href="/gruenden">Gründung</a></li></ul></li><li class="submenu subnavileft col"><a href="/3005">Hochschule</a><ul class="level_2"><li><a href="/name">Neuer Name</a></li><li><a href="/portraet">Porträt</a></li><li><a href="/3089">Organisation</a></li><li><a href="/3055">Einrichtungen</a></li><li><a href="/3005/campus">Campus</a></li><li><a href="/572">Menschen</a></li><li><a href="/karriere">Karriere</a></li></ul></li><li class="last col"><a href="/news">Aktuelles</a><ul class="level_2"><li><a href="/news">Aktuelle Meldungen</a></li><li><a href="/events">Veranstaltungskalender</a></li><li><a href="/jobs">Stellenausschreibungen</a></li><li><a href="/magazin">Magazin</a></li><li><a href="/pressespiegel">Pressespiegel</a></li></ul></li></ul>
</nav>
<div class="ce_text col-2 block">
</div>
</div>
<div id="copyright">
<div class="inside row">
<div class="col">
<a name="c19" id="anker19"></a>
<div id="c19" class="frame frame-default frame-type-text frame-layout-0"><p>© 2022 Berliner Hochschule für Technik</p></div>
</div>
<div class="col">
<a name="c20" id="anker20"></a>
<div id="c20" class="frame frame-default frame-type-text frame-layout-0"><p><a href="/impressum" title="Impressum" class="internal-link">Impressum</a>&nbsp; –&nbsp; <a href="/datenschutz" title="Datenschutzerklärung" class="internal-link">Datenschutz</a>&nbsp; –&nbsp; <a href="/barrierefreiheit" title="Erklärung zur digitalen Barrierefreiheit" class="internal-link">Barrierefreiheit</a></p></div>
</div>
</div>
</div>
</footer>
</body >
<LoginButton />
</div>
)
}
......
......@@ -9,7 +9,7 @@ class TopMenu extends Component {
return (
<div>
<Navbar bg="light" expand="lg">
<Navbar.Brand href="#home">React-Bootstrap</Navbar.Brand>
<Navbar.Brand href="#home">BHT</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="mr-auto">
......
import React, { Component } from "react";
import Button from "react-bootstrap/esm/Button";
import { connect } from "react-redux";
import { getShowLoginDialogAction } from "../actions/AuthenticationActions";
class loginButton extends Component {
constructor(props) {
......@@ -11,13 +13,13 @@ class loginButton extends Component {
showLoginDialog() {
const dispatch = this.props.dispatch;
dispatch()
dispatch(getShowLoginDialogAction())
}
render() {
return (
<div>
<Button variant="light" onClick={this.showLoginDialog}>
<Button variant="light" onClick={this.showLoginDialog} id="OpenLoginDialogButton">
Login
</Button>
</div>
......
import React, { Component } from "react";
import Button from "react-bootstrap/esm/Button";
import Modal from "react-bootstrap/Modal";
import Form from 'react-bootstrap/Form';
import React, { Component } from "react";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import * as authenticationActions from '../actions/AuthenticationActions'
const mapStateToProps = state => {
return state;
}
class userSessionWidget extends Component {
constructor(props) {
super(props)
this.state = {show: false};
this.state = {
username: '',
password: ''
};
this.handleShow = this.handleShow.bind(this);
this.handleClose = this.handleClose.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleShow(e) {
e.preventDefault();
this.setState({show: true})
const { showLoginDialogAction } = this.props;
showLoginDialogAction();
}
handleClose() {
const { hideLoginDialogAction } = this.props;
hideLoginDialogAction();
}
handleChange(e) {
const { name, value } = e.target;
this.setState({ [name]: value })
console.log(JSON.stringify(this.state))
}
handleClose(e) {
handleSubmit(e) {
e.preventDefault();
this.setState({show: false})
const { username, password } = this.state;
const { authenticateUserAction } = this.props;
authenticateUserAction(username, password);
console.log(username)
console.log(password)
console.log("Pushed Submit")
}
render() {
var showDialog = this.props.showLoginDialog
if (showDialog === undefined) {
showDialog = false
}
return (
<div>
<Button variant="primary" onClick={this.handleShow}>
<Button variant="primary" onClick={this.handleShow} id="OpenLoginDialogButton">
Login
</Button>
<Modal show={this.state.show} onHide={this.handleClose}>
<Modal show={showDialog} onHide={this.handleClose} id="LoginDialog">
<Modal.Header closeButton>
<Modal.Title>Modal title</Modal.Title>
<Modal.Title>Login</Modal.Title>
</Modal.Header>
<Modal.Body>
<p>Modal body text goes here.</p>
<Form>
<Form.Group className="mb-3">
<Form.Label>Email address</Form.Label>
<Form.Control type="email" placeholder="Enter email" name='username' onChange={this.handleChange} id="LoginDialogUserIDText"/>
</Form.Group>
<Form.Group className="mb-3">
<Form.Label>Password</Form.Label>
<Form.Control type="password" placeholder="Password" name='password' onChange={this.handleChange} id="LoginDialogPasswordText"/>
</Form.Group>
<Button variant="primary" type="submit" onClick={this.handleSubmit} id="PerformLoginButton">
Submit
</Button>
</Form>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={this.handleClose}>Close</Button>
<Button variant="primary" onClick={this.handleShow}>Save changes</Button>
Passwort vergessen?
</Modal.Footer>
</Modal>
</div>
......@@ -46,4 +94,11 @@ class userSessionWidget extends Component {
}
}
export default userSessionWidget
\ No newline at end of file
const mapDispatchToProps = dispatch => bindActionCreators({
showLoginDialogAction: authenticationActions.getShowLoginDialogAction,
hideLoginDialogAction: authenticationActions.getHideLoginDialogAction,
authenticateUserAction: authenticationActions.authenticateUser
}, dispatch)
const ConnectedUserSessionWidget = connect(mapStateToProps, mapDispatchToProps)(userSessionWidget)
export default ConnectedUserSessionWidget
\ No newline at end of file
import React from 'react';
import ReactDOM from 'react-dom/client';
import { createStore } from 'redux'
import { createStore, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
import rootReducer from './reducer/RootReducer';
const store = createStore(rootReducer)
const initialState = {
}
const middlewares = [thunk]
const store = createStore(rootReducer, initialState, applyMiddleware(...middlewares))
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
......
import * as authenticationActions from '../actions/AuthenticationActions'
const initialState = {
user:null,
user: null,
loginPending: false,
showLoginDialog: false
};
......@@ -7,7 +9,43 @@ const initialState = {
function rootReducer(state = initialState, action) {
console.log("Bin im reducer: " + action.type)
return state;
switch (action.type) {
case authenticationActions.SHOW_LOGIN_DIALOG:
return {
...state,
showLoginDialog: true,
error: null
}
case authenticationActions.HIDE_LOGIN_DIALOG:
return {
...state,
showLoginDialog: false,
error: null
}
case authenticationActions.AUTHENTICATION_PENDING:
return {
...state,
pending: true,
error: null
}
case authenticationActions.AUTHENTICATION_SUCCESS:
return {
...state,
showLoginDialog: false,
pending: false,
user: action.user,
accessToken: action.accessToken
}
case authenticationActions.AUTHENTICATION_ERROR:
return {
...state,
pending: false,
error: 'Authentication failed'
}
default:
return state;
}
};
export default rootReducer;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment