diff --git a/nginx.conf b/nginx.conf
index 802988f08..e605d3586 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -150,6 +150,17 @@ http {
}
#Load balancer
+ location /api/scevents/ {
+ resolver 127.0.0.11 valid=15s;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+
+ set $upstream http://scevents-server:8002;
+ rewrite ^/api/scevents/?(.*)$ /$1 break;
+ proxy_pass $upstream;
+ }
location /api {
proxy_pass http://mainendpoints;
}
diff --git a/src/APIFunctions/SCEvents.js b/src/APIFunctions/SCEvents.js
index c14d6bc46..1f434a4b7 100644
--- a/src/APIFunctions/SCEvents.js
+++ b/src/APIFunctions/SCEvents.js
@@ -1,6 +1,7 @@
import { ApiResponse } from './ApiResponses';
+import config from '../config/config.json';
-const SCEVENTS_API_URL = 'http://localhost:8002';
+const SCEVENTS_API_URL = config.SCEvents?.BASE_URL || '/api/scevents';
export async function getAllSCEvents() {
const status = new ApiResponse();
try {
diff --git a/src/Components/Navbar/AdminNavbar.js b/src/Components/Navbar/AdminNavbar.js
index de9754ab6..93f428c39 100644
--- a/src/Components/Navbar/AdminNavbar.js
+++ b/src/Components/Navbar/AdminNavbar.js
@@ -1,6 +1,5 @@
import React from 'react';
import { useSCE } from '../context/SceContext';
-import config from '../../config/config.json';
import { membershipState } from '../../Enums';
export default function UserNavBar(props) {
@@ -44,27 +43,25 @@ export default function UserNavBar(props) {
];
const sceventsAdminNavLinks = [];
- if (config.SCEvents?.ENABLED) {
+ sceventsAdminNavLinks.push({
+ title: 'Events',
+ route: '/events',
+ icon: (
+
+ ),
+ });
+ if (user?.accessLevel >= membershipState.OFFICER) {
sceventsAdminNavLinks.push({
- title: 'Events',
- route: '/events',
+ title: 'Create event',
+ route: '/events/create',
icon: (
),
});
- if (user?.accessLevel >= membershipState.OFFICER) {
- sceventsAdminNavLinks.push({
- title: 'Create event',
- route: '/events/create',
- icon: (
-
- ),
- });
- }
}
const adminLinks = [
diff --git a/src/Components/Navbar/UserNavbar.js b/src/Components/Navbar/UserNavbar.js
index 763608282..301860e9d 100644
--- a/src/Components/Navbar/UserNavbar.js
+++ b/src/Components/Navbar/UserNavbar.js
@@ -1,7 +1,6 @@
import React, { useState, useEffect, useRef } from 'react';
import { membershipState } from '../../Enums';
import { useSCE } from '../context/SceContext';
-import config from '../../config/config.json';
export default function UserNavbar(props) {
const { user, authenticated } = useSCE();
@@ -15,14 +14,12 @@ export default function UserNavbar(props) {
{ title: 'About', route: '/about' },
{ title: 'Projects', route: '/projects' },
{ title: 'Summer Internship', route: '/s/internship', newTab: true },
- ...(config.SCEvents?.ENABLED ? [{ title: 'Events', route: '/events' }] : []),
];
const authedRoutes = [
{ title: 'Printing', route: '/2DPrinting' },
{ title: 'Chat', route: '/messaging' },
{ title: 'LED Sign', route: '/led-sign' },
- ...(config.SCEvents?.ENABLED ? [{ title: 'Events', route: '/events' }] : []),
];
const authentication = [
diff --git a/src/Pages/Events/CreateEventPage.js b/src/Pages/Events/CreateEventPage.js
index 59ba96d48..fe23a89bc 100644
--- a/src/Pages/Events/CreateEventPage.js
+++ b/src/Pages/Events/CreateEventPage.js
@@ -1,11 +1,10 @@
/* eslint-disable camelcase -- mirrors SCEvents JSON field names in state and payloads */
import React, { useMemo, useState } from 'react';
-import { Link, useHistory, Redirect } from 'react-router-dom';
+import { Link, useHistory } from 'react-router-dom';
import { useSCE } from '../../Components/context/SceContext.js';
import { createSCEvent } from '../../APIFunctions/SCEvents.js';
import CreateEventFormQuestionBlock from './CreateEventFormQuestionBlock.js';
import { membershipState } from '../../Enums';
-import config from '../../config/config.json';
/** Matches SCEvents `max_attendees` when there is no cap. */
const UNLIMITED_ATTENDEES = -1;
@@ -71,7 +70,6 @@ function toApiRegistrationForm(questions) {
export default function CreateEventPage() {
const { user } = useSCE();
const history = useHistory();
- const isSCEventsEnabled = config.SCEvents?.ENABLED;
const [eventId] = useState(() => crypto.randomUUID());
const [eventName, setEventName] = useState('');
@@ -234,10 +232,6 @@ export default function CreateEventPage() {
history.push('/events');
}
- if (!isSCEventsEnabled) {
- return