lint fix + cleanup
This commit is contained in:
parent
d96a5bf084
commit
6ae3729a94
@ -2,7 +2,8 @@ import classNames from "classnames";
|
|||||||
|
|
||||||
export default function Button({ click, label, className = "font-thin text-sm" }) {
|
export default function Button({ click, label, className = "font-thin text-sm" }) {
|
||||||
return (
|
return (
|
||||||
<div
|
<button
|
||||||
|
type="button"
|
||||||
onClick={click}
|
onClick={click}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"bg-theme-900/20 hover:bg-theme-900/35 rounded m-1 flex-1 flex flex-col items-center justify-center text-center p-1",
|
"bg-theme-900/20 hover:bg-theme-900/35 rounded m-1 flex-1 flex flex-col items-center justify-center text-center p-1",
|
||||||
@ -11,6 +12,6 @@ export default function Button({ click, label, className = "font-thin text-sm" }
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className={className}>{label}</div>
|
<div className={className}>{label}</div>
|
||||||
</div>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,15 +4,15 @@ import Button from "components/services/widget/button";
|
|||||||
export default function Component({ service }) {
|
export default function Component({ service }) {
|
||||||
const { widget } = service;
|
const { widget } = service;
|
||||||
const { url, actions = [] } = widget;
|
const { url, actions = [] } = widget;
|
||||||
|
const urlTrailess = url.replace(/\/$/, "");
|
||||||
|
|
||||||
function startAction(actionId) {
|
function startAction(actionId) {
|
||||||
if (actionId) {
|
if (actionId) {
|
||||||
fetch(url.replace(/\/$/, "") + "/api/StartActionByGet/" + actionId).then((res) => {
|
fetch(`${urlTrailess}/api/StartActionByGet/${actionId}`).then((res) => {
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
return res.json();
|
return res.json();
|
||||||
} else {
|
|
||||||
throw new Error(res.statusText);
|
|
||||||
}
|
}
|
||||||
|
return res.statusText;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
import genericProxyHandler from "utils/proxy/handlers/generic";
|
|
||||||
|
|
||||||
const widget = {
|
|
||||||
api: "{url}/api/v1/{endpoint}/{key}",
|
|
||||||
proxyHandler: genericProxyHandler,
|
|
||||||
|
|
||||||
mappings: {
|
|
||||||
devices: {
|
|
||||||
endpoint: "devices",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default widget;
|
|
||||||
@ -60,7 +60,6 @@ import nextdns from "./nextdns/widget";
|
|||||||
import npm from "./npm/widget";
|
import npm from "./npm/widget";
|
||||||
import nzbget from "./nzbget/widget";
|
import nzbget from "./nzbget/widget";
|
||||||
import octoprint from "./octoprint/widget";
|
import octoprint from "./octoprint/widget";
|
||||||
import olivetin from "./olivetin/widget";
|
|
||||||
import omada from "./omada/widget";
|
import omada from "./omada/widget";
|
||||||
import ombi from "./ombi/widget";
|
import ombi from "./ombi/widget";
|
||||||
import opendtu from "./opendtu/widget";
|
import opendtu from "./opendtu/widget";
|
||||||
@ -176,7 +175,6 @@ const widgets = {
|
|||||||
npm,
|
npm,
|
||||||
nzbget,
|
nzbget,
|
||||||
octoprint,
|
octoprint,
|
||||||
olivetin,
|
|
||||||
omada,
|
omada,
|
||||||
ombi,
|
ombi,
|
||||||
opendtu,
|
opendtu,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user