summaryrefslogtreecommitdiff
path: root/src/lib/form_utils.ts
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-05-15 21:06:06 -0600
committerHombreLaser <sebastian-440@live.com>2023-05-15 21:06:06 -0600
commit2cc3bd2a5ab71ced121ea6e8fef3be5db2b98e4f (patch)
tree9da7b35b5e44e071dc44b7fb5cb54b1cff45994a /src/lib/form_utils.ts
parentd138c15dcd4272cd2358d28867ef35d1550b39cd (diff)
Resuelto bug de renderizado de errores
Diffstat (limited to 'src/lib/form_utils.ts')
-rw-r--r--src/lib/form_utils.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/form_utils.ts b/src/lib/form_utils.ts
index 73c5ba7..af29463 100644
--- a/src/lib/form_utils.ts
+++ b/src/lib/form_utils.ts
@@ -1,3 +1,5 @@
+import Token from "./token";
+
export interface Error {
field_div_id: string;
field_input_id: string;
@@ -21,6 +23,19 @@ export function setFormErrorsInSessionStorage(errors: Array<any>) {
}
}
+export function clearSessionStorage() {
+ const token = new Token();
+ const stored_token = sessionStorage.getItem('token');
+ const refresh_token = sessionStorage.getItem('refresh');
+
+ sessionStorage.clear();
+
+ if(stored_token && refresh_token) {
+ token.set(stored_token);
+ token.setRefresh(refresh_token);
+ }
+}
+
export function formHasErrors(fields: Array<string>) {
for(const field_key of fields) {
if(sessionStorage.getItem(field_key))