diff --git a/src/common/home.js b/src/common/home.js
index 4bf124f..c6169c5 100644
--- a/src/common/home.js
+++ b/src/common/home.js
@@ -25,10 +25,25 @@ class Home extends React.Component {
constructor(props) {
super(props);
+
+
+ // create url for API documentation, distinguish between localhost and production deployment
+ let docs_url = "";
+ let docs_location = "/swagger/index.html";
+ let base_url = window.location.origin;
+ if (base_url.search("localhost") === -1){
+ docs_url = base_url + docs_location;
+ } else {
+ // useful for local testing, replace port 3000 with port 4000 (port of backend)
+ docs_url = base_url.replace("3000", "4000") + docs_location;
+ }
+
this.state = {
currentUser: LoginStore.getState().currentUser,
- token: LoginStore.getState().token
+ token: LoginStore.getState().token,
+ docs_url: docs_url
};
+
}
getCounts(type) {
@@ -51,13 +66,17 @@ class Home extends React.Component {
- Welcome to {config.instance}!
- VILLASweb is a frontend for distributed real-time simulation hosted by {config.admin.name}.
+ Welcome to {config.instance} hosted by {config.admin.name}!
You are logged in as user {currentUser.username} with ID {currentUser.id} and role {currentUser.role}.
++ An interactive documentation of the VILLASweb API is available here. +
+ +