mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-20 21:59:40 +02:00
init 2
This commit is contained in:
commit
beed8576c2
137 changed files with 40218 additions and 0 deletions
44
frontend/src/api/themes.js
Normal file
44
frontend/src/api/themes.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
import { baseURL } from "./api-utils";
|
||||
import { apiReq } from "./api-utils";
|
||||
|
||||
const themesBase = baseURL + "site-settings/";
|
||||
|
||||
const settingsURLs = {
|
||||
allThemes: `${themesBase}themes/`,
|
||||
specificTheme: (themeName) => `${themesBase}themes/${themeName}/`,
|
||||
createTheme: `${themesBase}themes/create/`,
|
||||
updateTheme: (themeName) => `${themesBase}themes/${themeName}/update/`,
|
||||
deleteTheme: (themeName) => `${themesBase}themes/${themeName}/delete/`,
|
||||
};
|
||||
|
||||
export default {
|
||||
async requestAll() {
|
||||
let response = await apiReq.get(settingsURLs.allThemes);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
async requestByName(name) {
|
||||
let response = await apiReq.get(settingsURLs.specificTheme(name));
|
||||
console.log(response);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
async create(postBody) {
|
||||
let response = await apiReq.post(settingsURLs.createTheme, postBody);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
async update(themeName, colors) {
|
||||
const body = {
|
||||
name: themeName,
|
||||
colors: colors,
|
||||
};
|
||||
let response = await apiReq.post(settingsURLs.updateTheme(themeName), body);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
async delete(themeName) {
|
||||
let response = await apiReq.delete(settingsURLs.deleteTheme(themeName));
|
||||
return response.data;
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue