everything works with sending request and ccreating relationship
This commit is contained in:
@@ -71,7 +71,7 @@ async function addContact(req: Request, res: Response) {
|
||||
|
||||
insertResult
|
||||
? res.status(200).send(newRelationship)
|
||||
: res.status(500).send("Failed to create account, already exists");
|
||||
: res.status(500).send("Failed to create relationship, already exists");
|
||||
|
||||
return;
|
||||
} catch (error) {
|
||||
|
||||
@@ -52,8 +52,11 @@ const sendContactRequest = async (
|
||||
idToken: string,
|
||||
otherUserGoogleId: string
|
||||
) => {
|
||||
console.log(idToken);
|
||||
|
||||
const response = await axios.post(
|
||||
localHost + `/contacts/${otherUserGoogleId}`,
|
||||
null,
|
||||
{
|
||||
headers: { Authorization: idToken },
|
||||
}
|
||||
@@ -103,13 +106,6 @@ export function useConversationDetails(otherUserGoogleId: string) {
|
||||
}
|
||||
|
||||
// =========== MUTATIONS
|
||||
export function useCreateUser() {
|
||||
return useMutation(nirvanaApi.user.createUser, {
|
||||
onSettled: (data, error) => {
|
||||
return queryClient.invalidateQueries(Querytypes.GET_USER_DETAILS);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useSendContactRequest() {
|
||||
const authTokens = useRecoilValue($authTokens);
|
||||
|
||||
@@ -6,8 +6,6 @@ import { useRecoilState, useSetRecoilState } from "recoil";
|
||||
import { CircularProgress } from "@mui/material";
|
||||
import { FcGoogle } from "react-icons/fc";
|
||||
import Logo from "../../components/Logo";
|
||||
import { nirvanaApi } from "../../controller/nirvanaApi";
|
||||
import { useCreateUser } from "../../controller/index";
|
||||
|
||||
export default function Login({ onReady }: { onReady: Function }) {
|
||||
const setAuthTokens = useSetRecoilState($authTokens);
|
||||
|
||||
Reference in New Issue
Block a user