forgot pass and message

pull/1/head
Saeid 5 years ago
parent 2e75dfeb73
commit 0a36fbd734

@ -1,6 +1,6 @@
{
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=4c5fa0bdb556f1157fbf",
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=b418ebd88575764c1eef",
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=8eb2a7992f1192c1c852",
"/js/vue/User/app.js": "/js/vue/User/app.js?id=641003427457b9ee06d1"
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=01952a12eae064a9a3ce",
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=c8f7f128628d4199a9f4",
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=7dbb53bcc68b82e3aa7b",
"/js/vue/User/app.js": "/js/vue/User/app.js?id=0c533634f92fc1608e01"
}

@ -0,0 +1,115 @@
<template>
<div>
<v-snackbar
v-for="(message, key) in messages"
:key="key"
:color="message.color || 'black'"
:timeout="message.timeout || 3000"
v-model="message.snackbar"
:bottom="message.y === 'bottom'"
:left="message.x === 'left'"
:right="message.x === 'right'"
:top="message.y === 'top'"
>
{{message.content || ''}}
<v-btn :color="message.color_icon || 'white'" text @click="message.snackbar = false" fab>
<v-icon :color="message.color_icon || 'white'">{{ message.icon || "fas fa-times" }}</v-icon>
</v-btn>
</v-snackbar>
</div>
</template>
<script>
import { mapActions, mapGetters } from "vuex";
import axios from "axios";
import { TokenService } from "@Global/services/storage.services";
import ApiService from "@Global/services/api.services";
import store from "@Core/store/index";
import commonRoute from "@Global/utils/common/routes";
var default_message = {
snackbar: true,
content: "",
timeout: 3000,
color: "red",
icon: "fas fa-times",
color_icon: "white",
y: "",
x: ""
};
export default {
data: () => ({
messages: [{
snackbar: true,
content: "dsada",
timeout: 3000,
color: "red",
icon: "fas fa-times",
color_icon: "white"
},{
snackbar: true,
content: "wersdcasd",
timeout: 3000,
color: "red",
icon: "fas fa-times",
color_icon: "white"
}]
}),
methods: {
errorResponseHandler(error) {
// check for errorHandle config
if (
error.config.hasOwnProperty("errorHandle") &&
error.config.errorHandle === false
) {
return Promise.reject(error);
}
// if has response show the error
if (error.response) {
if (error.response.status == 401) {
TokenService.removeToken();
ApiService.removeAuthHeader();
store.commit("auth/logout", {}, { root: true });
if (commonRoute.login() != window.location.pathname) {
window.location.href = commonRoute.login();
}
let new_message = { ...default_message };
new_message.content = "نام کاربری یا رمز عبور اشتباه است";
this.messages.push(new_message);
} else if (error.response.status == 422) {
if (typeof error.response.data.errors !== "undefined") {
for (const key in error.response.data.errors) {
if (
error.response.data.errors.hasOwnProperty(key)
) {
let new_message = { ...default_message };
new_message.content =
"نام کاربری یا رمز عبور اشتباه است";
this.messages.push(new_message);
}
}
}
} else if (error.response.status == 500) {
let new_message = { ...default_message };
new_message.content = "مشکل از سمت سرور";
this.messages.push(new_message);
}
}
},
successHandler(response) {
// if(response.status == 200 || response.status == 201) {
// if(typeof response.data.message !== 'undefined') {
// toast.success(response.data.message, response.data.title);
// }
// }
return response;
}
},
created() {
axios.interceptors.response.use(
this.successHandler,
this.errorResponseHandler
);
}
};
</script>

@ -3,7 +3,7 @@ var CommingSoonArray = [
"discount",
"transaction",
"email",
"sms",
// "sms",
"prescription",
"crm-setting",

@ -10,13 +10,14 @@ import PageTitle from "@Global/components/Dividers/PageTitle.vue";
import Checkbox from "@Global/components/Inputs/Checkbox.vue";
import InfoBlock from "@Global/components/Misc/InfoBlock.vue";
import Breadcrumbs from "@Global/components/Misc/Breadcrumbs";
import Dialog from "@Global/components/Misc/Dialog.vue";
Vue.component("WM-PartTitle", PartTitle);
Vue.component("WM-PageTitle", PageTitle);
Vue.component("WM-Checkbox", Checkbox);
Vue.component("WM-InfoBlock", InfoBlock);
Vue.component("wm-breadcrumbs", Breadcrumbs);
Vue.component("wm-dialog", Dialog);
//jalali => 0.6MB
import jalaliMoment from "vue-jalali-moment"

@ -41,11 +41,11 @@ function errorResponseHandler(error) {
}
}
function successHandler(response) {
// if(response.status == 200 || response.status == 201) {
// if(typeof response.data.message !== 'undefined') {
// toast.success(response.data.message, response.data.title);
// }
// }
if(response.status == 200 || response.status == 201) {
if(typeof response.data.message !== 'undefined' && typeof response.data.message.content !== 'undefined') {
toast.success(response.data.message.content, response.data.message.title || 'موفق');
}
}
return response;
}

@ -22,5 +22,5 @@ export default {
state.modal.dialog = true;
commit('SET_DIALOG_TYPE', properties.type);
commit('SET_DIALOG_PROPERTIES', properties);
}
},
};

@ -13,5 +13,5 @@ export default {
},
SET_DIALOG_PROPERTIES(state, properties = {}) {
state.dialogProperties = properties;
}
},
};

@ -6,5 +6,5 @@ export default {
dialog: false,
},
dialogProperties: {},
dialogType: {}
dialogType: {},
};

@ -133,6 +133,7 @@
website: "آدرس سایت",
name: "نام",
text: "متن",
smsContent: "متن پیام",
client_type: "نوع مشتری",
cell_number: " شماره همراه ",
password: " کلمه عبور ",

Loading…
Cancel
Save