@go-avro/avro-js 0.0.2-beta.87 → 0.0.2-beta.89

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.
@@ -263,6 +263,20 @@ export declare class AvroQueryClient {
263
263
  code?: string;
264
264
  cancelToken?: CancelToken;
265
265
  }>>;
266
+ useRequestCode(): ReturnType<typeof useMutation<{
267
+ msg: string;
268
+ }, StandardError, {
269
+ username?: string;
270
+ email?: string;
271
+ cancelToken?: CancelToken;
272
+ }>>;
273
+ useUpdatePassword(): ReturnType<typeof useMutation<void, StandardError, {
274
+ username?: string;
275
+ email?: string;
276
+ code: string;
277
+ newPassword: string;
278
+ cancelToken?: CancelToken;
279
+ }>>;
266
280
  useGoogleLogin(): ReturnType<typeof useMutation<LoginResponse, StandardError, {
267
281
  token: string;
268
282
  cancelToken?: CancelToken;
@@ -100,6 +100,35 @@ export class AvroQueryClient {
100
100
  }
101
101
  });
102
102
  }
103
+ useRequestCode() {
104
+ const queryClient = useQueryClient();
105
+ return useMutation({
106
+ mutationFn: async ({ username, email, cancelToken }) => {
107
+ const resp = await this.post('/code', JSON.stringify({ username, email }), cancelToken, { 'Content-Type': 'application/json' });
108
+ return resp;
109
+ },
110
+ onSettled: () => {
111
+ queryClient.invalidateQueries();
112
+ },
113
+ onError: (err) => {
114
+ throw new StandardError(err.status, err.message || 'Request code failed');
115
+ }
116
+ });
117
+ }
118
+ useUpdatePassword() {
119
+ const queryClient = useQueryClient();
120
+ return useMutation({
121
+ mutationFn: async ({ username, email, code, newPassword, cancelToken }) => {
122
+ await this.post('/update-password', JSON.stringify({ username, email, code, password: newPassword }), cancelToken, { 'Content-Type': 'application/json' });
123
+ },
124
+ onSettled: () => {
125
+ queryClient.invalidateQueries();
126
+ },
127
+ onError: (err) => {
128
+ throw new StandardError(err.status, err.message || 'Update password failed');
129
+ }
130
+ });
131
+ }
103
132
  useGoogleLogin() {
104
133
  const queryClient = useQueryClient();
105
134
  return useMutation({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.87",
3
+ "version": "0.0.2-beta.89",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",