feature/recipe-patch-improvements (#382)

* automated docs update

* recipe rating component

* recipe partial updates - closes #25

* use Vue.delete to update store

* format

* arrow functions

* fix tests

* format

* initial context menu

* localize

* add confirmation dialog

* context menu

* fix bare exception

* update line length

* format all file with prettier

* update changelog

* download as json

* update python dependencies

* update javascript dependencies

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden
2021-05-01 20:46:02 -08:00
committed by GitHub
parent c196445e61
commit be378cb20c
121 changed files with 18942 additions and 4765 deletions

View File

@@ -1,7 +1,7 @@
import { baseURL } from "./api-utils";
import { apiReq } from "./api-utils";
import axios from "axios";
import i18n from '@/i18n.js';
import i18n from "@/i18n.js";
const authPrefix = baseURL + "auth";
const userPrefix = baseURL + "users";
@@ -19,22 +19,19 @@ const usersURLs = {
};
function deleteErrorText(response) {
switch(response.data.detail) {
case 'SUPER_USER':
return i18n.t('user.error-cannot-delete-super-user');
switch (response.data.detail) {
case "SUPER_USER":
return i18n.t("user.error-cannot-delete-super-user");
default:
return i18n.t('user.you-are-not-allowed-to-delete-this-user');
return i18n.t("user.you-are-not-allowed-to-delete-this-user");
}
}
export const userAPI = {
async login(formData) {
let response = await apiReq.post(
authURLs.token,
formData,
null,
function() { return i18n.t('user.user-successfully-logged-in'); }
);
let response = await apiReq.post(authURLs.token, formData, null, function() {
return i18n.t("user.user-successfully-logged-in");
});
return response;
},
async refresh() {
@@ -49,10 +46,10 @@ export const userAPI = {
},
create(user) {
return apiReq.post(
usersURLs.users,
usersURLs.users,
user,
function() { return i18n.t('user.user-creation-failed'); },
function() { return i18n.t('user.user-created'); }
() => i18n.t("user.user-creation-failed"),
() => i18n.t("user.user-created")
);
},
async self() {
@@ -65,35 +62,32 @@ export const userAPI = {
},
update(user) {
return apiReq.put(
usersURLs.userID(user.id),
usersURLs.userID(user.id),
user,
function() { return i18n.t('user.user-update-failed'); },
function() { return i18n.t('user.user-updated'); }
() => i18n.t("user.user-update-failed"),
() => i18n.t("user.user-updated")
);
},
changePassword(id, password) {
return apiReq.put(
usersURLs.password(id),
usersURLs.password(id),
password,
function() { return i18n.t('user.existing-password-does-not-match'); },
function() { return i18n.t('user.password-updated'); }
);
},
delete(id) {
return apiReq.delete(
usersURLs.userID(id),
null,
deleteErrorText,
function() { return i18n.t('user.user-deleted'); }
() => i18n.t("user.existing-password-does-not-match"),
() => i18n.t("user.password-updated")
);
},
delete(id) {
return apiReq.delete(usersURLs.userID(id), null, deleteErrorText, function() {
return i18n.t("user.user-deleted");
});
},
resetPassword(id) {
return apiReq.put(
usersURLs.resetPassword(id),
null,
function() { return i18n.t('user.password-reset-failed'); },
function() { return i18n.t('user.password-has-been-reset-to-the-default-password'); }
() => i18n.t("user.password-reset-failed"),
() => i18n.t("user.password-has-been-reset-to-the-default-password")
);
},
};