mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 09:45:22 +03:00
change to query parameter from header
This commit is contained in:
parent
69e1148ac6
commit
176c355720
@ -710,7 +710,7 @@ def config_raw():
|
||||
|
||||
@bp.route("/config/save", methods=["POST"])
|
||||
def config_save():
|
||||
save_option = request.headers.get("Save-Option")
|
||||
save_option = request.args.get("save_option")
|
||||
|
||||
new_config = request.get_data().decode()
|
||||
|
||||
|
||||
@ -17,37 +17,14 @@ export default function Config() {
|
||||
const [success, setSuccess] = useState();
|
||||
const [error, setError] = useState();
|
||||
|
||||
const onHandleSaveConfig = async (e) => {
|
||||
const onHandleSaveConfig = async (e, save_option) => {
|
||||
if (e) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
axios
|
||||
.post('config/save', window.editor.getValue(), {
|
||||
headers: { 'Content-Type': 'text/plain', 'Save-Option': 'restart' },
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
setSuccess(response.data);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.response) {
|
||||
setError(error.response.data.message);
|
||||
} else {
|
||||
setError(error.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const onHandleSaveConfigOnly = async (e) => {
|
||||
if (e) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
axios
|
||||
.post('config/save', window.editor.getValue(), {
|
||||
headers: { 'Content-Type': 'text/plain', 'Save-Option': 'saveonly' },
|
||||
.post('config/save?save_option='+save_option, window.editor.getValue(), {
|
||||
headers: { 'Content-Type': 'text/plain' },
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
@ -120,10 +97,10 @@ export default function Config() {
|
||||
<Button className="mx-2" onClick={(e) => handleCopyConfig(e)}>
|
||||
Copy Config
|
||||
</Button>
|
||||
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e)}>
|
||||
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e, "restart")}>
|
||||
Save & Restart
|
||||
</Button>
|
||||
<Button className="mx-2" onClick={(e) => onHandleSaveConfigOnly(e)}>
|
||||
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e, "saveonly")}>
|
||||
Save Only
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user