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

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,13 @@ 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
+ }>>;
266
273
  useGoogleLogin(): ReturnType<typeof useMutation<LoginResponse, StandardError, {
267
274
  token: string;
268
275
  cancelToken?: CancelToken;
@@ -100,6 +100,21 @@ 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
+ }
103
118
  useGoogleLogin() {
104
119
  const queryClient = useQueryClient();
105
120
  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.88",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",