mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-03 02:33:31 -05:00
More localization (#358)
* Translate missing items on About page * Localize import summary dialog * Make site menu translation reactive * Localize import options * Include semi colon in string * Move API texts to frontend + better status codes * Provide feedback to user when no meal is planned * Fix API tests after latest rework * Add warning for API changes in changelog * Refactor API texts handling * Refactor API texts handling #2 * Better API feedback * Rearrange strings hierarchy * Add messages upon recipe updated * Fix 'recipe effected' typo * Remove snackbar usage in backend * Translate toolbox * Provide feedback for tags CRUD * Fix messed up merge * Translate sign-up form * Better feedback for sign-up CRUD * Refactor log-in API texts handling * No error message when user is not authenticated * Remove unimportant console log
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { baseURL } from "./api-utils";
|
||||
import { apiReq } from "./api-utils";
|
||||
import { store } from "@/store";
|
||||
import i18n from '@/i18n.js';
|
||||
|
||||
const settingsBase = baseURL + "site-settings";
|
||||
|
||||
@@ -19,9 +20,16 @@ export const siteSettingsAPI = {
|
||||
},
|
||||
|
||||
async update(body) {
|
||||
let response = await apiReq.put(settingsURLs.updateSiteSettings, body);
|
||||
store.dispatch("requestSiteSettings");
|
||||
return response.data;
|
||||
const response = await apiReq.put(
|
||||
settingsURLs.updateSiteSettings,
|
||||
body,
|
||||
function() { return i18n.t('settings.settings-update-failed'); },
|
||||
function() { return i18n.t('settings.settings-updated'); }
|
||||
);
|
||||
if(response) {
|
||||
store.dispatch("requestSiteSettings");
|
||||
}
|
||||
return response;
|
||||
},
|
||||
|
||||
async getPages() {
|
||||
@@ -34,23 +42,39 @@ export const siteSettingsAPI = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
async createPage(body) {
|
||||
let response = await apiReq.post(settingsURLs.customPages, body);
|
||||
return response.data;
|
||||
createPage(body) {
|
||||
return apiReq.post(
|
||||
settingsURLs.customPages,
|
||||
body,
|
||||
function() { return i18n.t('page.page-creation-failed'); },
|
||||
function() { return i18n.t('page.new-page-created'); }
|
||||
);
|
||||
},
|
||||
|
||||
async deletePage(id) {
|
||||
let response = await apiReq.delete(settingsURLs.customPage(id));
|
||||
return response.data;
|
||||
return await apiReq.delete(
|
||||
settingsURLs.customPage(id),
|
||||
null,
|
||||
function() { return i18n.t('page.page-deletion-failed'); },
|
||||
function() { return i18n.t('page.page-deleted'); });
|
||||
},
|
||||
|
||||
async updatePage(body) {
|
||||
let response = await apiReq.put(settingsURLs.customPage(body.id), body);
|
||||
return response.data;
|
||||
updatePage(body) {
|
||||
return apiReq.put(
|
||||
settingsURLs.customPage(body.id),
|
||||
body,
|
||||
function() { return i18n.t('page.page-update-failed'); },
|
||||
function() { return i18n.t('page.page-updated'); }
|
||||
);
|
||||
},
|
||||
|
||||
async updateAllPages(allPages) {
|
||||
let response = await apiReq.put(settingsURLs.customPages, allPages);
|
||||
let response = await apiReq.put(
|
||||
settingsURLs.customPages,
|
||||
allPages,
|
||||
function() { return i18n.t('page.pages-update-failed'); },
|
||||
function() { return i18n.t('page.pages-updated'); }
|
||||
);
|
||||
return response;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user