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

Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page