mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
16 lines
343 B
TypeScript
16 lines
343 B
TypeScript
import type { Plugin } from '@nuxt/types';
|
|
|
|
const plugin: Plugin = ({ $axios, app }) => {
|
|
$axios.onRequest((config) => {
|
|
const token = app.$csrfToken();
|
|
|
|
if (!config.headers['X-CSRF-Token'] && token) {
|
|
config.headers['X-CSRF-Token'] = token;
|
|
}
|
|
|
|
return config;
|
|
});
|
|
};
|
|
|
|
export default plugin;
|