nuxt init

This commit is contained in:
hay-kot
2021-07-31 14:00:28 -08:00
parent 79b3985a49
commit 8d3db89327
275 changed files with 13274 additions and 4003 deletions

View 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;
},
},
};

View 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;
},
},
};

View File

@@ -0,0 +1,7 @@
export const utilMixins = {
commputed: {
isMobile() {
return this.$vuetify.breakpoint.name === "xs";
},
},
};

View 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"),
};
},
};