Has anyone received a compile error that makes you use , instead of ; in an axios call?axios preflight fail error 301 using vue.jsVue-axios interceptor 401 errorReact native axios calling action inside .then callback not workingis there any better way to handling axios error with laravel and vue jsGet a 401 error with POST and PUT Laravel passport/Vue/AxiosAxios: Not going into catch method with errorAxios POST returns “Network Error” even if status is 200 and there's a responseJS Axios - how to get response body in event of error?axios not failing on get call in NS VUEJS APPTypeError: Cannot read property 'status' of undefined when receiving errors from Laravel validation

Why weren't the Death Star plans transmitted electronically?

On the meaning of 'anyways' in "What Exactly Is a Quartz Crystal, Anyways?"

How can this Stack Exchange site have an animated favicon?

Quick Yajilin Puzzles: Scatter and Gather

Can an integer optimization problem be convex?

Why does C++ have 'Undefined Behaviour' and other languages like C# or Java don't?

Safe to use 220V electric clothes dryer when building has been bridged down to 110V?

Does "as soon as" imply simultaneity?

Worms crawling under skin

How do pilots align the HUD with their eyeballs?

Is it a good idea to leave minor world details to the reader's imagination?

Is differentiation as a map discontinuous?

Do wheelchair aircraft exist?

Proper way to shut down consumer

Clear text passwords in Unix

Should the average user with no special access rights be worried about SMS-based 2FA being theoretically interceptable?

Do we have any particular tonal center in mind when we are NOT listening music?

Tesla coil and Tesla tower

How to justify a team increase when the team is doing good?

Is it impolite to ask for halal food when traveling to and in Thailand?

Do we know the situation in Britain before Sealion (summer 1940)?

relating two diagrams in tikzcd

Aesthetic proofs that involve Field Theory / Galois Theory

Lost Update Understanding



Has anyone received a compile error that makes you use , instead of ; in an axios call?


axios preflight fail error 301 using vue.jsVue-axios interceptor 401 errorReact native axios calling action inside .then callback not workingis there any better way to handling axios error with laravel and vue jsGet a 401 error with POST and PUT Laravel passport/Vue/AxiosAxios: Not going into catch method with errorAxios POST returns “Network Error” even if status is 200 and there's a responseJS Axios - how to get response body in event of error?axios not failing on get call in NS VUEJS APPTypeError: Cannot read property 'status' of undefined when receiving errors from Laravel validation






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















Compile error unless I use a comma in an axios call.



Here is the error. 'Unexpected token, expected ","'



in a vue I have an axios call.



axios
.get('/api/messages/'+this.issue)
.then(response => (

this.messages = response.data;

console.log(response.data);

))
.catch(error => console.log(error));


I get a compile error if I don't use commas.



axios
.get('/api/messages/'+this.issue)
.then(response => (

this.messages = response.data,

console.log(response.data)

))
.catch(error => console.log(error));


I also get a compile error if I try to run an if() statement in .then(). I'm using the latest versions of Laravel, Vue and Axios. Has amyone else had this issue? or have a fix?










share|improve this question
























  • That's because you're using () instead of in your then callback

    – Derek Pollard
    Mar 28 at 18:13

















1















Compile error unless I use a comma in an axios call.



Here is the error. 'Unexpected token, expected ","'



in a vue I have an axios call.



axios
.get('/api/messages/'+this.issue)
.then(response => (

this.messages = response.data;

console.log(response.data);

))
.catch(error => console.log(error));


I get a compile error if I don't use commas.



axios
.get('/api/messages/'+this.issue)
.then(response => (

this.messages = response.data,

console.log(response.data)

))
.catch(error => console.log(error));


I also get a compile error if I try to run an if() statement in .then(). I'm using the latest versions of Laravel, Vue and Axios. Has amyone else had this issue? or have a fix?










share|improve this question
























  • That's because you're using () instead of in your then callback

    – Derek Pollard
    Mar 28 at 18:13













1












1








1








Compile error unless I use a comma in an axios call.



Here is the error. 'Unexpected token, expected ","'



in a vue I have an axios call.



axios
.get('/api/messages/'+this.issue)
.then(response => (

this.messages = response.data;

console.log(response.data);

))
.catch(error => console.log(error));


I get a compile error if I don't use commas.



axios
.get('/api/messages/'+this.issue)
.then(response => (

this.messages = response.data,

console.log(response.data)

))
.catch(error => console.log(error));


I also get a compile error if I try to run an if() statement in .then(). I'm using the latest versions of Laravel, Vue and Axios. Has amyone else had this issue? or have a fix?










share|improve this question














Compile error unless I use a comma in an axios call.



Here is the error. 'Unexpected token, expected ","'



in a vue I have an axios call.



axios
.get('/api/messages/'+this.issue)
.then(response => (

this.messages = response.data;

console.log(response.data);

))
.catch(error => console.log(error));


I get a compile error if I don't use commas.



axios
.get('/api/messages/'+this.issue)
.then(response => (

this.messages = response.data,

console.log(response.data)

))
.catch(error => console.log(error));


I also get a compile error if I try to run an if() statement in .then(). I'm using the latest versions of Laravel, Vue and Axios. Has amyone else had this issue? or have a fix?







laravel vue.js axios






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 17:38









mkrisch76mkrisch76

215 bronze badges




215 bronze badges















  • That's because you're using () instead of in your then callback

    – Derek Pollard
    Mar 28 at 18:13

















  • That's because you're using () instead of in your then callback

    – Derek Pollard
    Mar 28 at 18:13
















That's because you're using () instead of in your then callback

– Derek Pollard
Mar 28 at 18:13





That's because you're using () instead of in your then callback

– Derek Pollard
Mar 28 at 18:13












1 Answer
1






active

oldest

votes


















1
















The Issue



Your error is because javascript expects response => () to be a statement that is returned.



You can think of it like saying response => return (/* code */)



Solution



Instead, in order to use the arrow function without an immediate return, switch to brackets:



response => 


That way, javascript no longer expects a statement that returns right away, and will execute like a function with the full power of js.



Hope this helps!






share|improve this answer



























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403807%2fhas-anyone-received-a-compile-error-that-makes-you-use-instead-of-in-an-axio%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1
















    The Issue



    Your error is because javascript expects response => () to be a statement that is returned.



    You can think of it like saying response => return (/* code */)



    Solution



    Instead, in order to use the arrow function without an immediate return, switch to brackets:



    response => 


    That way, javascript no longer expects a statement that returns right away, and will execute like a function with the full power of js.



    Hope this helps!






    share|improve this answer





























      1
















      The Issue



      Your error is because javascript expects response => () to be a statement that is returned.



      You can think of it like saying response => return (/* code */)



      Solution



      Instead, in order to use the arrow function without an immediate return, switch to brackets:



      response => 


      That way, javascript no longer expects a statement that returns right away, and will execute like a function with the full power of js.



      Hope this helps!






      share|improve this answer



























        1














        1










        1









        The Issue



        Your error is because javascript expects response => () to be a statement that is returned.



        You can think of it like saying response => return (/* code */)



        Solution



        Instead, in order to use the arrow function without an immediate return, switch to brackets:



        response => 


        That way, javascript no longer expects a statement that returns right away, and will execute like a function with the full power of js.



        Hope this helps!






        share|improve this answer













        The Issue



        Your error is because javascript expects response => () to be a statement that is returned.



        You can think of it like saying response => return (/* code */)



        Solution



        Instead, in order to use the arrow function without an immediate return, switch to brackets:



        response => 


        That way, javascript no longer expects a statement that returns right away, and will execute like a function with the full power of js.



        Hope this helps!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 18:16









        Derek PollardDerek Pollard

        4,7776 gold badges27 silver badges41 bronze badges




        4,7776 gold badges27 silver badges41 bronze badges

































            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403807%2fhas-anyone-received-a-compile-error-that-makes-you-use-instead-of-in-an-axio%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript