Skip to content

Commit

Permalink
fix: parse first state
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-pluto committed Dec 24, 2023
1 parent 91b5a71 commit e6dd31f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ export default class ViewStateManager {

private async _extractStateFromForm() {
const form = await parseFormData(this._astro.request);
const value = form.get(this.filedName).toString();
form.delete(this.filedName);
return value;
return form.get(this.filedName)?.toString();
}

private async _parseState() {
try {
const state = await this._extractStateFromForm();
if(state == null) return;

const data = this._cryptr.decrypt(state);
const uncompress = await snappy.uncompress(Buffer.from(data, 'base64'));
return superjson.parse(uncompress.toString());
Expand Down

0 comments on commit e6dd31f

Please sign in to comment.