Skip to content

Instantly share code, notes, and snippets.

View jkque's full-sized avatar

John Kevin Cadungog jkque

View GitHub Profile
@jkque
jkque / promise.js
Created February 6, 2020 06:43
javascript promise flow
let fill_details = () => {
return new Promise(resolve => {
resolve('done');
});
}
let async_call_fill_details = async () => {
const result = await fill_details();
}
async_call_fill_details();
@jkque
jkque / interceptors.js
Last active February 6, 2020 06:43
Interceptors for axios
window.axios.interceptors.response.use(undefined, error => {
switch(error.response.status){
case 401: // Not logged in
case 419: // Session expired
case 503: // Down for maintenance
window.location.reload();
break;
case 500:
alert('Oops, something went wrong! The team have been notified.');
break;