Created
April 14, 2021 03:06
-
-
Save DeVoresyah/4f2a60141660f2ae00d1e3820d0b737e to your computer and use it in GitHub Desktop.
Logic Response Handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const checkStatusResponse = response => { | |
if (response.code === 9999) { | |
// run a function if response ok | |
} else { | |
// run a function if response failure | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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