Show local vs. external message on storage config page

This commit is contained in:
Gabe Kangas 2020-10-29 10:22:31 -07:00
parent 83de63b1e8
commit 8e907eb8f3

View File

@ -1,12 +1,21 @@
import React, { useState, useEffect } from 'react';
import { SERVER_CONFIG, fetchData, FETCH_INTERVAL } from './utils/apis';
import KeyValueTable from './components/key-value-table';
import React, { useState, useEffect } from "react";
import { SERVER_CONFIG, fetchData, FETCH_INTERVAL } from "./utils/apis";
import KeyValueTable from "./components/key-value-table";
function Storage({ config }) {
if (!config) {
return null;
}
if (!config.s3.enabled) {
return (
<h3>
Local storage is being used. Enable external S3 storage if you want
to use it.
</h3>
);
}
const data = [
{
name: "Enabled",
@ -42,10 +51,9 @@ export default function ServerConfig() {
const getInfo = async () => {
try {
const result = await fetchData(SERVER_CONFIG);
console.log("viewers result", result)
console.log("viewers result", result);
setConfig({ ...result });
} catch (error) {
setConfig({ ...config, message: error.message });
}
@ -60,7 +68,7 @@ export default function ServerConfig() {
// returned function will be called on component unmount
return () => {
clearInterval(getStatusIntervalId);
}
};
}, []);
return (
@ -82,4 +90,3 @@ export default function ServerConfig() {
</div>
);
}