Move preset management into a separate file

This commit is contained in:
Cohee
2023-09-16 17:36:54 +03:00
parent 38b63b07f5
commit 61995bb33f
4 changed files with 101 additions and 74 deletions

View File

@ -133,7 +133,7 @@ class PresetManager {
async savePreset(name, settings) {
const preset = settings ?? this.getPresetSettings(name);
const res = await fetch(`/save_preset`, {
const res = await fetch(`/api/presets/save`, {
method: "POST",
headers: getRequestHeaders(),
body: JSON.stringify({ preset, name, apiId: this.apiId })
@ -303,7 +303,7 @@ class PresetManager {
$(this.select).trigger('change');
}
const response = await fetch('/delete_preset', {
const response = await fetch('/api/presets/delete', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ name: nameToDelete, apiId: this.apiId }),