From 2cc3bd2a5ab71ced121ea6e8fef3be5db2b98e4f Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Mon, 15 May 2023 21:06:06 -0600 Subject: Resuelto bug de renderizado de errores --- src/lib/form_utils.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/lib') 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) { } } +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) { for(const field_key of fields) { if(sessionStorage.getItem(field_key)) -- cgit v1.2.3