@leisuresaas/react 0.1.0 → 0.1.2-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/auth.ts +14 -0
- package/src/index.ts +2 -0
package/package.json
CHANGED
package/src/auth.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LeisureSaasHttpError } from "./errors";
|
|
2
2
|
import { applyPublishableKeyHeaders } from "./publishable-key";
|
|
3
3
|
|
|
4
|
+
export { LeisureSaasHttpError };
|
|
5
|
+
|
|
4
6
|
/** Browser product-account calls. Platform is always web; pass the site origin. */
|
|
5
7
|
export type PublicAuthContext = {
|
|
6
8
|
gatewayUrl: string;
|
|
@@ -122,6 +124,18 @@ export async function requestProductEmailVerification(
|
|
|
122
124
|
await publicAuthRequest(ctx, "/email-verification", { email: input.email, locale: input.locale ?? "" });
|
|
123
125
|
}
|
|
124
126
|
|
|
127
|
+
export async function confirmProductEmailVerification(ctx: PublicAuthContext, token: string): Promise<ProductAuthTokens> {
|
|
128
|
+
const resp = await publicAuthRequest<TokenJSON>(ctx, "/email-verification/confirm", { token });
|
|
129
|
+
return tokensFromJSON(resp);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export async function confirmProductPasswordReset(
|
|
133
|
+
ctx: PublicAuthContext,
|
|
134
|
+
input: { token: string; newPassword: string },
|
|
135
|
+
): Promise<void> {
|
|
136
|
+
await publicAuthRequest(ctx, "/password-reset/confirm", { token: input.token, new_password: input.newPassword });
|
|
137
|
+
}
|
|
138
|
+
|
|
125
139
|
export async function changeProductPassword(
|
|
126
140
|
ctx: PublicAuthContext,
|
|
127
141
|
accessToken: string,
|
package/src/index.ts
CHANGED