Skip to content

Instantly share code, notes, and snippets.

@DeVoresyah
Created April 14, 2021 03:06
Show Gist options
  • Save DeVoresyah/4f2a60141660f2ae00d1e3820d0b737e to your computer and use it in GitHub Desktop.
Save DeVoresyah/4f2a60141660f2ae00d1e3820d0b737e to your computer and use it in GitHub Desktop.
Logic Response Handler
export const checkStatusResponse = response => {
if (response.code === 9999) {
// run a function if response ok
} else {
// run a function if response failure
}
}
import { checkStatusResponse } from 'helper.js'
{
if (response.ok) {
checkStatusResponse(response)
} else {
// like usual, no need change
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment