summaryrefslogtreecommitdiff
path: root/DESIGN.md
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-04-08 09:34:25 -0300
committerSebastian <sebasjm@gmail.com>2021-04-08 09:55:22 -0300
commitf2dfda17f27d5a842eaa77711e411313ddfc6039 (patch)
treeff70953a10ff6309a80a728e29715146c1eb1fe3 /DESIGN.md
parent234a34b4235d9736cab2bb8723c29008e837fd60 (diff)
downloadmerchant-backoffice-f2dfda17f27d5a842eaa77711e411313ddfc6039.tar.gz
merchant-backoffice-f2dfda17f27d5a842eaa77711e411313ddfc6039.tar.bz2
merchant-backoffice-f2dfda17f27d5a842eaa77711e411313ddfc6039.zip
new order (WIP)
Diffstat (limited to 'DESIGN.md')
-rw-r--r--DESIGN.md58
1 files changed, 58 insertions, 0 deletions
diff --git a/DESIGN.md b/DESIGN.md
new file mode 100644
index 0000000..6e71776
--- /dev/null
+++ b/DESIGN.md
@@ -0,0 +1,58 @@
+# Page internal routing
+
+* The SPA is loaded from the BACKOFFICE_URL
+
+* The view to be rendered is decided by the URL fragment
+
+* Query parameters that may affect routing
+
+ - instance: use from the default instance to mimic another instance management
+
+* The user must provide BACKEND_URL or BACKOFFICE_URL will use as default
+
+* Token for querying the backend will be saved in localStorage under backend-token-${name}
+
+# HTTP queries to the backend
+
+HTTP queries will have 4 states:
+
+* loading: request did not end yet. data and error are undefined
+
+* ok: data has information, http response status == 200
+
+* clientError: http response status is between 400 and 499
+
+ - notfound: http status 404
+
+ - unauthorized: http status 401
+
+* serverError: http response status is grater than 500
+
+There are categories of queries:
+
+ * sync: getting information for the page rendering
+
+ * async: performing an CRUD operation
+
+## Loading the page information (sync)
+
+In this scenario, a failed request will make the app flow to break.
+
+When receiving an notfound error a generic not found page will be shown. If the BACKEND_URL points to a default instance it should send the user to create the instance.
+
+When receiving an unauthorized error, the user should be prompted with a login form.
+
+When receiving an another error (400 < http status < 600), the login form should be shown with an error message using the hint from the backend.
+
+On other unexpected error (like network error), the login form should be shown with and error message.
+
+## CRUD operation (async)
+
+In this scenario, a failed request does not break the flow but a message will be prompted.
+
+# Forms
+
+# Custom Hooks
+
+# Contexts
+