Last active
April 7, 2021 09:41
-
-
Save Coordinate-Cat/251b64106562fd7d9b32094957148948 to your computer and use it in GitHub Desktop.
microCMS api default
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 default { | |
async asyncData({ $config, error }) { | |
try { | |
const { data } = await axios.get( | |
' URL ', | |
{ headers: { ' API NAME ': $config.apiKey } } | |
) | |
return data | |
} catch (err) { | |
error({ | |
statusCode: err.response.status, | |
message: err.response.data.message, | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment