B
B
BonBon Slick2019-08-09 16:22:09
Vue.js
BonBon Slick, 2019-08-09 16:22:09

Should library parameters be taken out in state?

computed: {
            ...mapGetters({
                userToken: 'User/token',
            }),
        },
        mounted() {
            // http://www.resumablejs.com/
            const $this = this;
            // @todo - should be state?
 const resumblejs = this.resumablejs = new Resumable({
                target: `${process.env.STORAGE_API_URL}/download/chunk`,
                headers: {
                     'X-AUTH-TOKEN': this.userToken,
                 },
                chunkSize: 1024 * 500, // prevent nginx file size limit 413 error
                prioritizeFirstAndLastChunk: true,
                simultaneousUploads: 1,
                // testChunks: true,
                maxFiles: 1,
                uploadMethod: 'POST',
                retryDelays: [0, 1000, 3000, 5000],
                query: {
                    token: process.env.STORAGE_SECRET,
                },
            });


Whether to take out such configs in a state or a separate file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-08-11
@BonBonSlick

What's the point of this? Are you going to override these parameters at runtime? In an amicable way, to transfer parameters at initialization. If this is not possible, write a wrapper that will pass default parameters, as well as mix in parameters that can be optionally passed when called.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question