Git Product home page Git Product logo

Comments (5)

alexusmai avatar alexusmai commented on August 17, 2024 2

Hi Dmitry.
Thanks for the suggestions. Now I am working on a new version, I will try to think of something.

from vue-laravel-file-manager.

alexusmai avatar alexusmai commented on August 17, 2024 1

Done. But not tested..

Vue.use(FileManager, {
    store, // required
    
    // not required params
    headers: {'Authorization': 'Bearer ...'}, // add header
    // OR
    headers: {'X-CSRF-TOKEN': 'token'}, // overwrite default header Axios
    baseUrl: 'http://my_url:80/file-manager/', // overwrite base url Axios
    windowsConfig: 2,
    lang: 'de',     // set language
    translation: {  // add new translation
        name: de,
        content: {
            about: 'Über',
            back: 'Zurück',
            ... see lang file structure
        },
    },
}

from vue-laravel-file-manager.

DmitrySkibitsky avatar DmitrySkibitsky commented on August 17, 2024

Temporary solution

// node_modules/laravel-file-manager/src/http/axios-settings.js

let configAxios = {
    baseURL: `${location.protocol}//${location.hostname}/file-manager/`,
    headers: {
        'X-Requested-With': 'XMLHttpRequest',
        'X-CSRF-TOKEN': token.content,
    },
}

const user = (localStorage.getItem('user') !== undefined) ? JSON.parse(localStorage.getItem('user')) : null;
if (user !== null) {
    configAxios.headers.Authorization = `Bearer ${user.token}`;
}

const HTTP = axios.create(configAxios);

from vue-laravel-file-manager.

DmitrySkibitsky avatar DmitrySkibitsky commented on August 17, 2024

It won't hurt

let baseURL = `${location.protocol}//${location.hostname}`;
if (location.port.length) {
  baseURL += `:${location.port}`;
}

As for example when the server is started through artisan serv there is a port in the URL.

from vue-laravel-file-manager.

DmitrySkibitsky avatar DmitrySkibitsky commented on August 17, 2024

Still would not hurt to be able to add a prefix to the URL requests. Since on the server side the routes can be, for example, in routes.api

Vue.use(FileManager, {
      'store' => store, //required
      'headers' => {'Authorization'  => 'Bearer ...'}, //not required
      'urlPrefix' => 'api' //not required
});

Where 'headers' will be merged with the headers object which is in axios-settings

from vue-laravel-file-manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.