mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-25 05:04:05 -05:00
nuxt init
This commit is contained in:
18
frontend.old/src/mixins/initials.js
Normal file
18
frontend.old/src/mixins/initials.js
Normal file
@@ -0,0 +1,18 @@
|
||||
export const initials = {
|
||||
computed: {
|
||||
initials() {
|
||||
if (!this.user.fullName) return "00"
|
||||
const allNames = this.user.fullName.trim().split(" ");
|
||||
const initials = allNames.reduce(
|
||||
(acc, curr, index) => {
|
||||
if (index === 0 || index === allNames.length - 1) {
|
||||
acc = `${acc}${curr.charAt(0).toUpperCase()}`;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
[""]
|
||||
);
|
||||
return initials;
|
||||
},
|
||||
},
|
||||
};
|
||||
24
frontend.old/src/mixins/user.js
Normal file
24
frontend.old/src/mixins/user.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { store } from "@/store";
|
||||
export const user = {
|
||||
computed: {
|
||||
user() {
|
||||
return store.getters.getUserData;
|
||||
},
|
||||
loggedIn() {
|
||||
return store.getters.getIsLoggedIn;
|
||||
},
|
||||
initials() {
|
||||
const allNames = this.user.fullName.trim().split(" ");
|
||||
const initials = allNames.reduce(
|
||||
(acc, curr, index) => {
|
||||
if (index === 0 || index === allNames.length - 1) {
|
||||
acc = `${acc}${curr.charAt(0).toUpperCase()}`;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
[""]
|
||||
);
|
||||
return initials;
|
||||
},
|
||||
},
|
||||
};
|
||||
7
frontend.old/src/mixins/utilMixins.js
Normal file
7
frontend.old/src/mixins/utilMixins.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export const utilMixins = {
|
||||
commputed: {
|
||||
isMobile() {
|
||||
return this.$vuetify.breakpoint.name === "xs";
|
||||
},
|
||||
},
|
||||
};
|
||||
15
frontend.old/src/mixins/validators.js
Normal file
15
frontend.old/src/mixins/validators.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@(([[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
|
||||
export const validators = {
|
||||
data() {
|
||||
return {
|
||||
emailRule: v => !v || EMAIL_REGEX.test(v) || this.$t("user.e-mail-must-be-valid"),
|
||||
|
||||
existsRule: value => !!value || this.$t("general.field-required"),
|
||||
|
||||
minRule: v => v.length >= 8 || this.$t("user.use-8-characters-or-more-for-your-password"),
|
||||
|
||||
whiteSpace: v => !v || v.split(" ").length <= 1 || this.$t("recipe.no-white-space-allowed"),
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user