Created
June 4, 2023 18:53
-
-
Save themegabyte/b7d8167eecf427fa16b0d8b9ebe24d77 to your computer and use it in GitHub Desktop.
Directus SDK with Axios Interceptors.
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
import { Directus } from "@directus/sdk"; | |
const DIRECTUS_ENDPOINT = process.env.DIRECTUS_HOST || ""; | |
const DIRECTUS_TOKEN = process.env.DIRECTUS_TOKEN || ""; | |
const directus = new Directus(DIRECTUS_ENDPOINT, { | |
auth: { | |
staticToken: DIRECTUS_TOKEN, | |
}, | |
}); | |
directus.transport.axios.interceptors.response.use((response) => { | |
console.log("inside response interceptor"); | |
console.log("Response:", response); | |
console.log("exiting response interceptor"); | |
return response; | |
}); | |
export default directus; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment