commit
eec09d2ce8
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class BuildSwagger extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'swagger:build';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Build swagger api list.';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$basePath = base_path();
|
||||||
|
exec("$basePath/vendor/bin/openapi --bootstrap $basePath/development/swagger-constants.php --output $basePath/public/swagger/swagger.json $basePath/development/swagger-v1.php $basePath/app/Http/Controllers $basePath/modules --format json");
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=76568d2c558db0b483df",
|
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=dd02beb5a55225686934",
|
||||||
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=c0280289836d237df34a",
|
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=a3421df14f4c8868afc0",
|
||||||
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=d1f47ccae7e3c752e2cd",
|
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=d5c5768d6fa5b68ca971",
|
||||||
"/js/vue/User/app.js": "/js/vue/User/app.js?id=1a70a4db289a0cd1791c"
|
"/js/vue/User/app.js": "/js/vue/User/app.js?id=94b6e24df1d748e97e78"
|
||||||
}
|
}
|
||||||
|
@ -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>
|
Loading…
Reference in new issue