Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/assets/vue/services/colorThemeService.js

50 lines
965 B

import baseService from "./baseService"
const url = "/api/color_themes"
/**
* Gets the color themes
*
* @returns {Promise<{totalItems, items}>}
*/
async function findAllByCurrentUrl() {
return await baseService.getCollection("/api/access_url_rel_color_themes")
}
/**
* Update or create a theme with the title
*
* @param {string|null} iri
* @param {string} title
* @param {Object} colors
* @returns {Promise<Object>}
*/
async function updateTheme({ iri = null, title, colors }) {
if (iri) {
return await baseService.put(iri, {
title,
variables: colors,
})
}
return await baseService.post(url, {
title,
variables: colors,
})
}
/**
* @param {string} iri
* @returns {Promise<Object>}
*/
async function changePlatformColorTheme(iri) {
return baseService.post("/api/access_url_rel_color_themes", {
colorTheme: iri,
})
}
export default {
updateTheme,
findAllByCurrentUrl,
changePlatformColorTheme,
}