Commit 45f2b398 authored by Vipul Basapati's avatar Vipul Basapati

Added new way in Flash.vue to not hide the flash message. Added the same...

Added new way in Flash.vue to not hide the flash message. Added the same functionality in GeneralException to store a  variable
parent 43e3781f
......@@ -9,4 +9,28 @@ use Exception;
*/
class GeneralException extends Exception
{
/**
* message
*
* @var string
*/
public $message;
/**
* dontHide
*
* @var bool
*/
public $dontHide;
/**
* Constructor function
*
* @param string $message
* @param boolean $dontHide
*/
public function __construct($message, $dontHide = false) {
$this->message = $message;
$this->dontHide = $dontHide;
}
}
......@@ -53,7 +53,6 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $exception)
{
//dd($exception);
if (strpos($request->url(), '/api/') !== false) {
\Log::debug('API Request Exception - '.$request->url().' - '.$exception->getMessage().(!empty($request->all()) ? ' - '.json_encode($request->except(['password'])) : ''));
......@@ -112,6 +111,8 @@ class Handler extends ExceptionHandler
* All instances of GeneralException redirect back with a flash message to show a bootstrap alert-error
*/
if ($exception instanceof GeneralException) {
session()->flash('dontHide', $exception->dontHide);
return redirect()->back()->withInput()->withFlashDanger($exception->getMessage());
}
......
......@@ -21,7 +21,7 @@ class LoginController extends Controller
use AuthenticatesUsers;
/**
* @var CMSPagesRepository
* @var \App\Http\Utilities\PushNotification
*/
protected $notification;
......@@ -74,7 +74,7 @@ class LoginController extends Controller
if (!$user->isConfirmed()) {
access()->logout();
throw new GeneralException(trans('exceptions.frontend.auth.confirmation.resend', ['user_id' => $user->id]));
throw new GeneralException(trans('exceptions.frontend.auth.confirmation.resend', ['user_id' => $user->id]), true);
} elseif (!$user->isActive()) {
access()->logout();
......
......@@ -6,7 +6,7 @@
<script>
export default {
props: ["message", "type"],
props: ["message", "type", "dontHide"],
data() {
return {
......@@ -17,9 +17,10 @@ export default {
},
created() {
var context = this;
const context = this;
if (this.message && this.type) {
this.flash(this.message, this.type);
this.flash(this.message, this.type, this.dontHide);
}
window.events.$on("flash", function(message, type) {
......@@ -28,7 +29,7 @@ export default {
},
methods: {
flash(message, type) {
flash(message, type, dontHide = false) {
if (! type) {
type = "info";
......@@ -38,7 +39,9 @@ export default {
this.typeClass = "alert alert-" + type;
this.show = true;
if(! dontHide) {
this.hide();
}
},
hide() {
......
@php
$message = '';
$type = '';
@endphp
$dontHide = false;
if(session()->has('dontHide')) {
$dontHide = session()->get('dontHide');
}
@endphp
@if ($errors->any())
@php
$type = 'danger';
......@@ -80,4 +84,4 @@
@endif
<!-- Flash Message Vue component -->
<flash message="{!! $message !!}" type="{{ $type }}"></flash>
\ No newline at end of file
<flash message="{!! $message !!}" type="{{ $type }}" dont-hide="{{ $dontHide }}"></flash>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment