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
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
add a comment |
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
I would use vuex to manage the server interaction throughactions
. 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
add a comment |
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
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
vue.js vuejs2 axios
asked Mar 7 at 14:17
HafinatorHafinator
15
15
I would use vuex to manage the server interaction throughactions
. 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
add a comment |
I would use vuex to manage the server interaction throughactions
. 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
add a comment |
1 Answer
1
active
oldest
votes
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:
Show the error message
Make user to click some button again to show the popup
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.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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:
Show the error message
Make user to click some button again to show the popup
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.
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
add a comment |
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:
Show the error message
Make user to click some button again to show the popup
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.
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
add a comment |
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:
Show the error message
Make user to click some button again to show the popup
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.
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:
Show the error message
Make user to click some button again to show the popup
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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