[Vuejs]-POST requests in axios for creating object in django restframework api

0๐Ÿ‘

โœ…

Do this work?

this.$http.interceptors.request.use(
  config => {
    const token=this.$store.getters.getToken;
    if (token) {
      config.headers.Authorization = "Token " + token;
    }
    return config;
  }
);
this.$http.post('posts/', {'text': 'asdasd'})

Leave a comment