We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01c1a5f commit eb26d34Copy full SHA for eb26d34
‎exercises/user_signup/solutions/codely_next-typescript-middle-out/src/services/signUpUser.ts‎
@@ -1,3 +1,14 @@
1
-export async function signUpUser({name, email}: {name: string, email: string}): Promise<void> {
2
- return;
+export async function signUpUser(userData: {name: string, email: string}): Promise<void> {
+ await fetch("/api/signup", {
3
+ method: "POST",
4
+ body: JSON.stringify(userData),
5
+ headers: {
6
+ "Content-Type": "application/json",
7
+ },
8
+ })
9
+ .then(response => {
10
+ if (response.status !== 200) {
11
+ throw new Error()
12
+ }
13
14
}
0 commit comments