()
+ // for other than Next.js
+ const code = useMemo(() => {
+ const queryParams = new URLSearchParams(window.location.search)
+
+ return queryParams.get("code")
+ }, [])
+
+ const sendCallback = async () => {
+ const { token } = await fetch(
+ `http://localhost:9000/auth/customer/google/callback?code=${code}`,
+ {
+ credentials: "include",
+ method: "POST",
+ }
+ ).then((res) => res.json())
+
+ if (!token) {
+ alert("Authentication Failed")
+ return
+ }
+
+ return token
+ }
+
+ // TODO add more functions
+
+ return (
+
+ {loading && Loading...}
+ {customer && Created customer {customer.email} with Google.}
+
+ )
+}
+```
+
+