Vue.js Should you emit data from popup back to the main window?2019 Community Moderator Electionvue.js: how to access component data from action?How do I handle data I receive from an outside API within VueJS?Prevent vue.js from re-rendering data?Best practice for storing auth tokens in VueJS?A method that calls an API using Axios isn't behaving sequentiallyvuejs frontend development without backend: how to write fixtures?repetedly call a axios.get to display data from endpointHow Do I Use Axios to Post Form Data?Invalid argument Supplied for foreach() Axios LaravelVueJS pass data between two pages

Time travel from stationary position?

What has been your most complicated TikZ drawing?

Are all passive ability checks floors for active ability checks?

What should tie a collection of short-stories together?

In a future war, an old lady is trying to raise a boy but one of the weapons has made everyone deaf

The difference between「N分で」and「後N分で」

Recruiter wants very extensive technical details about all of my previous work

Look at your watch and tell me what time is it. vs Look at your watch and tell me what time it is

Do the common programs (for example: "ls", "cat") in Linux and BSD come from the same source code?

Why doesn't the EU now just force the UK to choose between referendum and no-deal?

Why do Australian milk farmers need to protest supermarkets' milk price?

Can I use USB data pins as power source

How to deal with taxi scam when on vacation?

How to use deus ex machina safely?

My Graph Theory Students

Is it normal that my co-workers at a fitness company criticize my food choices?

Brexit - No Deal Rejection

Do I need to be arrogant to get ahead?

If the DM rolls initiative once for a group of monsters, how do end-of-turn effects work?

If I can solve Sudoku can I solve Travelling Salesman Problem(TSP)? If yes, how?

What is the significance behind "40 days" that often appears in the Bible?

A Cautionary Suggestion

What approach do we need to follow for projects without a test environment?

Can a druid choose the size of its wild shape beast?



Vue.js Should you emit data from popup back to the main window?



2019 Community Moderator Electionvue.js: how to access component data from action?How do I handle data I receive from an outside API within VueJS?Prevent vue.js from re-rendering data?Best practice for storing auth tokens in VueJS?A method that calls an API using Axios isn't behaving sequentiallyvuejs frontend development without backend: how to write fixtures?repetedly call a axios.get to display data from endpointHow Do I Use Axios to Post Form Data?Invalid argument Supplied for foreach() Axios LaravelVueJS pass data between two pages










0















I and my co-workers can't seem to agree on what the best practice should be when it comes to Vue and popups.
The question is as follows:



You are on the main window, you get the data from the backend using REST API and you notice an error. To fix it, you go to an edit popup and after hitting save what should happen?



  • Should you call the API from the popup?

  • Emit the changed data and let the main window call the API?

  • ...









share|improve this question






















  • I would use vuex to manage the server interaction through actions. The modal would only need to initiate the request. The nice thing is that it keeps the business logic in one place (if you do it for all REST API reqs).

    – Daniel
    Mar 7 at 17:27















0















I and my co-workers can't seem to agree on what the best practice should be when it comes to Vue and popups.
The question is as follows:



You are on the main window, you get the data from the backend using REST API and you notice an error. To fix it, you go to an edit popup and after hitting save what should happen?



  • Should you call the API from the popup?

  • Emit the changed data and let the main window call the API?

  • ...









share|improve this question






















  • I would use vuex to manage the server interaction through actions. The modal would only need to initiate the request. The nice thing is that it keeps the business logic in one place (if you do it for all REST API reqs).

    – Daniel
    Mar 7 at 17:27













0












0








0








I and my co-workers can't seem to agree on what the best practice should be when it comes to Vue and popups.
The question is as follows:



You are on the main window, you get the data from the backend using REST API and you notice an error. To fix it, you go to an edit popup and after hitting save what should happen?



  • Should you call the API from the popup?

  • Emit the changed data and let the main window call the API?

  • ...









share|improve this question














I and my co-workers can't seem to agree on what the best practice should be when it comes to Vue and popups.
The question is as follows:



You are on the main window, you get the data from the backend using REST API and you notice an error. To fix it, you go to an edit popup and after hitting save what should happen?



  • Should you call the API from the popup?

  • Emit the changed data and let the main window call the API?

  • ...






vue.js vuejs2 axios






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 14:17









HafinatorHafinator

15




15












  • I would use vuex to manage the server interaction through actions. The modal would only need to initiate the request. The nice thing is that it keeps the business logic in one place (if you do it for all REST API reqs).

    – Daniel
    Mar 7 at 17:27

















  • I would use vuex to manage the server interaction through actions. The modal would only need to initiate the request. The nice thing is that it keeps the business logic in one place (if you do it for all REST API reqs).

    – Daniel
    Mar 7 at 17:27
















I would use vuex to manage the server interaction through actions. The modal would only need to initiate the request. The nice thing is that it keeps the business logic in one place (if you do it for all REST API reqs).

– Daniel
Mar 7 at 17:27





I would use vuex to manage the server interaction through actions. The modal would only need to initiate the request. The nice thing is that it keeps the business logic in one place (if you do it for all REST API reqs).

– Daniel
Mar 7 at 17:27












1 Answer
1






active

oldest

votes


















0














This is very interesting question but I think the truth depends on your whole architecture, implementation and approaches you use.



Say, if you worry about the "separation of concern" you wouldn't give a popup any access to API because its work is to show you some data as a popup, return data, and that's it.



On the other hand, how are you handling errors? What if an error occurs when user works in popup? Where do you show error?



Another question is the usability. For example, if error occurs when you save data, if it's done by the main window, you are going to:



  1. Show the error message


  2. Make user to click some button again to show the popup


  3. Fix a problem and click the Save button in it.


But if you would access API right from popup you would avoid first 2 steps. Another concern is how you handle wrong data.



If you are still in the popup you easily can validate the data and cancel saving (or disable this button at all) but if it's done after the popup is closed it may be too late.






share|improve this answer























  • Aha!! I see what you're saying. It is best if we ask ourselves how we will handle the wrong input/server errors, and then proceed. I have gone with the route of "The main window will close the popup if successful"

    – Hafinator
    22 hours ago












  • @Hafinator Right, and maybe it's worth to ask your users too :) anyway the idea is to review the workflow from different sides: implementation, error handling, usability etc.

    – Skipper
    12 hours ago










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/3.0/"u003ecc by-sa 3.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%2f55045941%2fvue-js-should-you-emit-data-from-popup-back-to-the-main-window%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









0














This is very interesting question but I think the truth depends on your whole architecture, implementation and approaches you use.



Say, if you worry about the "separation of concern" you wouldn't give a popup any access to API because its work is to show you some data as a popup, return data, and that's it.



On the other hand, how are you handling errors? What if an error occurs when user works in popup? Where do you show error?



Another question is the usability. For example, if error occurs when you save data, if it's done by the main window, you are going to:



  1. Show the error message


  2. Make user to click some button again to show the popup


  3. Fix a problem and click the Save button in it.


But if you would access API right from popup you would avoid first 2 steps. Another concern is how you handle wrong data.



If you are still in the popup you easily can validate the data and cancel saving (or disable this button at all) but if it's done after the popup is closed it may be too late.






share|improve this answer























  • Aha!! I see what you're saying. It is best if we ask ourselves how we will handle the wrong input/server errors, and then proceed. I have gone with the route of "The main window will close the popup if successful"

    – Hafinator
    22 hours ago












  • @Hafinator Right, and maybe it's worth to ask your users too :) anyway the idea is to review the workflow from different sides: implementation, error handling, usability etc.

    – Skipper
    12 hours ago















0














This is very interesting question but I think the truth depends on your whole architecture, implementation and approaches you use.



Say, if you worry about the "separation of concern" you wouldn't give a popup any access to API because its work is to show you some data as a popup, return data, and that's it.



On the other hand, how are you handling errors? What if an error occurs when user works in popup? Where do you show error?



Another question is the usability. For example, if error occurs when you save data, if it's done by the main window, you are going to:



  1. Show the error message


  2. Make user to click some button again to show the popup


  3. Fix a problem and click the Save button in it.


But if you would access API right from popup you would avoid first 2 steps. Another concern is how you handle wrong data.



If you are still in the popup you easily can validate the data and cancel saving (or disable this button at all) but if it's done after the popup is closed it may be too late.






share|improve this answer























  • Aha!! I see what you're saying. It is best if we ask ourselves how we will handle the wrong input/server errors, and then proceed. I have gone with the route of "The main window will close the popup if successful"

    – Hafinator
    22 hours ago












  • @Hafinator Right, and maybe it's worth to ask your users too :) anyway the idea is to review the workflow from different sides: implementation, error handling, usability etc.

    – Skipper
    12 hours ago













0












0








0







This is very interesting question but I think the truth depends on your whole architecture, implementation and approaches you use.



Say, if you worry about the "separation of concern" you wouldn't give a popup any access to API because its work is to show you some data as a popup, return data, and that's it.



On the other hand, how are you handling errors? What if an error occurs when user works in popup? Where do you show error?



Another question is the usability. For example, if error occurs when you save data, if it's done by the main window, you are going to:



  1. Show the error message


  2. Make user to click some button again to show the popup


  3. Fix a problem and click the Save button in it.


But if you would access API right from popup you would avoid first 2 steps. Another concern is how you handle wrong data.



If you are still in the popup you easily can validate the data and cancel saving (or disable this button at all) but if it's done after the popup is closed it may be too late.






share|improve this answer













This is very interesting question but I think the truth depends on your whole architecture, implementation and approaches you use.



Say, if you worry about the "separation of concern" you wouldn't give a popup any access to API because its work is to show you some data as a popup, return data, and that's it.



On the other hand, how are you handling errors? What if an error occurs when user works in popup? Where do you show error?



Another question is the usability. For example, if error occurs when you save data, if it's done by the main window, you are going to:



  1. Show the error message


  2. Make user to click some button again to show the popup


  3. Fix a problem and click the Save button in it.


But if you would access API right from popup you would avoid first 2 steps. Another concern is how you handle wrong data.



If you are still in the popup you easily can validate the data and cancel saving (or disable this button at all) but if it's done after the popup is closed it may be too late.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 8 at 5:23









SkipperSkipper

913




913












  • Aha!! I see what you're saying. It is best if we ask ourselves how we will handle the wrong input/server errors, and then proceed. I have gone with the route of "The main window will close the popup if successful"

    – Hafinator
    22 hours ago












  • @Hafinator Right, and maybe it's worth to ask your users too :) anyway the idea is to review the workflow from different sides: implementation, error handling, usability etc.

    – Skipper
    12 hours ago

















  • Aha!! I see what you're saying. It is best if we ask ourselves how we will handle the wrong input/server errors, and then proceed. I have gone with the route of "The main window will close the popup if successful"

    – Hafinator
    22 hours ago












  • @Hafinator Right, and maybe it's worth to ask your users too :) anyway the idea is to review the workflow from different sides: implementation, error handling, usability etc.

    – Skipper
    12 hours ago
















Aha!! I see what you're saying. It is best if we ask ourselves how we will handle the wrong input/server errors, and then proceed. I have gone with the route of "The main window will close the popup if successful"

– Hafinator
22 hours ago






Aha!! I see what you're saying. It is best if we ask ourselves how we will handle the wrong input/server errors, and then proceed. I have gone with the route of "The main window will close the popup if successful"

– Hafinator
22 hours ago














@Hafinator Right, and maybe it's worth to ask your users too :) anyway the idea is to review the workflow from different sides: implementation, error handling, usability etc.

– Skipper
12 hours ago





@Hafinator Right, and maybe it's worth to ask your users too :) anyway the idea is to review the workflow from different sides: implementation, error handling, usability etc.

– Skipper
12 hours ago



















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%2f55045941%2fvue-js-should-you-emit-data-from-popup-back-to-the-main-window%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

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived