Skip to content

Instantly share code, notes, and snippets.

Avatar

Mohd Saqueib Ansari saqueib

View GitHub Profile
@saqueib
saqueib / errorHandler.js
Last active Jun 9, 2022
Global error handling using axios interceptor for http calls http://www.qcode.in/api-error-handling-in-vue-with-axios
View errorHandler.js
import axios from 'axios'
import toast from './toast'
function 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
@saqueib
saqueib / states-ui.scss
Last active May 9, 2018
is-loading and ui-disabled state classes
View states-ui.scss
// Colors
$defaultSpinnerColor: #dbdbdb;
$primarySpinnerColor: #f0704b;
$lightSpinnerColor: #f3f3f3;
$darkSpinnerColor: #060303;
// Misc
$spinnerDefaultSize: 1rem;
$disabledUiOpacity: 0.7;
@saqueib
saqueib / SimplePagination.vue
Last active Dec 23, 2020
VueJS pagination component to paginate anything in Laravel, checkout the tutorial on http://wp.me/p8cmxL-b7 by www.qcode.in
View SimplePagination.vue
<template>
<div :class="{'loading': loading}" class="pager-data-wrapper">
<!-- Pagination Slot -->
<slot :result="getResult()">
<div class="text-center alert-info pb-3">
<span v-if="!loading">
{{ result.length }} items found. render it using v-for="item in result"
</span>
<span v-if="loading">
@saqueib
saqueib / 0_uploader.blade.php
Last active Jun 9, 2021
Reusable upload component in Laravel with Dropzone.js - visit http://wp.me/p8cmxL-9Q for tutorial
View 0_uploader.blade.php
@php $dropzoneId = isset($dz_id) ? $dz_id : str_random(8); @endphp
<div id="{{$dropzoneId}}" class="dropzone">
<div class="dz-default dz-message">
<h3>{{ $title or 'Drop files here or click to upload.'}}</h3>
<p class="text-muted">{{ $desc or 'Any related files you can upload' }} <br>
<small>One file can be max {{ config('attachment.max_size', 0) / 1000 }} MB</small></p>
</div>
</div>
<!-- Dropzone {{ $dropzoneId }} -->