Skip to content

Instantly share code, notes, and snippets.

@TonyDalian
TonyDalian / axios.refresh_token.1.js
Created February 5, 2021 14:58 — forked from Godofbrowser/axios.refresh_token.1.js
Axios interceptor for refresh token when you have multiple parallel requests. Demo implementation: https://github.com/Godofbrowser/axios-refresh-multiple-request
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@TonyDalian
TonyDalian / vue-custom-input-component-exercise.js
Created August 31, 2017 16:48 — forked from laracasts/vue-custom-input-component-exercise.js
vuecasts.com - Custom Input Components exercise.
Vue.component('coupon', {
props: ['code'],
template: `
<input type="text"
:value="code"
@input="updateCode($event.target.value)"
ref="input">
`,
let webpack = require('webpack');
let path = require('path');
module.exports = {
entry: {
app: './resources/assets/js/app.js',
vendor: ['vue', 'axios']
},
output: {