Created
September 17, 2018 17:56
-
-
Save Fabianopb/9f5831a794d3a1aab710b46c24c2e006 to your computer and use it in GitHub Desktop.
private method in the App.tsx for express-react-ts-ci Medium story
This file contains hidden or 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
private getTestData = async (): Promise<void> => { | |
try { | |
this.setState({ error: "" }); | |
const response = await axios.get<Item[]>("/api/items", { headers: session.getAuthHeaders() }); | |
this.setState({ data: response.data }); | |
} catch (error) { | |
this.setState({ error: "Something went wrong" }); | |
} finally { | |
this.setState({ isRequesting: false }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment