better-auth
Version:
The most comprehensive authentication framework for TypeScript.
1 lines • 858 B
Source Map (JSON)
{"version":3,"file":"fetch-plugins.mjs","names":[],"sources":["../../src/client/fetch-plugins.ts"],"sourcesContent":["import type { BetterFetchPlugin } from \"@better-fetch/fetch\";\n\nexport const redirectPlugin = {\n\tid: \"redirect\",\n\tname: \"Redirect\",\n\thooks: {\n\t\tonSuccess(context) {\n\t\t\tif (context.data?.url && context.data?.redirect) {\n\t\t\t\tif (typeof window !== \"undefined\" && window.location) {\n\t\t\t\t\tif (window.location) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\twindow.location.href = context.data.url;\n\t\t\t\t\t\t} catch {}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t},\n} satisfies BetterFetchPlugin;\n"],"mappings":";AAEA,MAAa,iBAAiB;CAC7B,IAAI;CACJ,MAAM;CACN,OAAO,EACN,UAAU,SAAS;AAClB,MAAI,QAAQ,MAAM,OAAO,QAAQ,MAAM,UACtC;OAAI,OAAO,WAAW,eAAe,OAAO,UAC3C;QAAI,OAAO,SACV,KAAI;AACH,YAAO,SAAS,OAAO,QAAQ,KAAK;YAC7B;;;IAKZ;CACD"}