mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
17 lines
468 B
TypeScript
17 lines
468 B
TypeScript
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
|
|
|
|
const sendUserFollowRequest = async (userId: string) => {
|
|
const response = await fetch(`/api/users/${userId}/follow-user`, { method: 'POST' });
|
|
const json = await response.json();
|
|
|
|
const parsed = APIResponseValidationSchema.safeParse(json);
|
|
|
|
if (!parsed.success) {
|
|
throw new Error('Invalid API response.');
|
|
}
|
|
|
|
return parsed;
|
|
};
|
|
|
|
export default sendUserFollowRequest;
|