sparse-intern-71089
10/18/2022, 5:54 PMhelpful-easter-62786
10/18/2022, 6:38 PMaxios
library a little differentlyhelpful-easter-62786
10/18/2022, 6:40 PMexport const fooResponse = z.object({
bar: z.string(),
});
export type FooResponse = z.infer<typeof fooResponse>;
export const makeHttpCall = async (
ax: AxiosInstance,
name: string,
baz: string
): Promise<string> => {
const response = await <http://ax.post|ax.post>(`${somePath}/blah/${name}`, {
somefield: baz,
});
return response.parse(response.data).bar;
};
helpful-easter-62786
10/18/2022, 6:43 PMhelpful-easter-62786
10/18/2022, 6:44 PMexport const fooResponse = z.object({
bar: z.string(),
});
export type FooResponse = z.infer<typeof fooResponse>;
export const makeHttpCall = async (
ax: AxiosInstance,
name: string,
baz: string
): Promise<string> => {
const response = await <http://ax.post|ax.post><FooResponse>(`${somePath}/blah/${name}`, {
somefield: baz,
});
return response.bar;
};
helpful-easter-62786
10/18/2022, 6:45 PMcrypto.randomInt
?