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
|
insertResult
|
||||||
? res.status(200).send(newRelationship)
|
? 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;
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -52,8 +52,11 @@ const sendContactRequest = async (
|
|||||||
idToken: string,
|
idToken: string,
|
||||||
otherUserGoogleId: string
|
otherUserGoogleId: string
|
||||||
) => {
|
) => {
|
||||||
|
console.log(idToken);
|
||||||
|
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
localHost + `/contacts/${otherUserGoogleId}`,
|
localHost + `/contacts/${otherUserGoogleId}`,
|
||||||
|
null,
|
||||||
{
|
{
|
||||||
headers: { Authorization: idToken },
|
headers: { Authorization: idToken },
|
||||||
}
|
}
|
||||||
@@ -103,13 +106,6 @@ export function useConversationDetails(otherUserGoogleId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =========== MUTATIONS
|
// =========== MUTATIONS
|
||||||
export function useCreateUser() {
|
|
||||||
return useMutation(nirvanaApi.user.createUser, {
|
|
||||||
onSettled: (data, error) => {
|
|
||||||
return queryClient.invalidateQueries(Querytypes.GET_USER_DETAILS);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useSendContactRequest() {
|
export function useSendContactRequest() {
|
||||||
const authTokens = useRecoilValue($authTokens);
|
const authTokens = useRecoilValue($authTokens);
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import { useRecoilState, useSetRecoilState } from "recoil";
|
|||||||
import { CircularProgress } from "@mui/material";
|
import { CircularProgress } from "@mui/material";
|
||||||
import { FcGoogle } from "react-icons/fc";
|
import { FcGoogle } from "react-icons/fc";
|
||||||
import Logo from "../../components/Logo";
|
import Logo from "../../components/Logo";
|
||||||
import { nirvanaApi } from "../../controller/nirvanaApi";
|
|
||||||
import { useCreateUser } from "../../controller/index";
|
|
||||||
|
|
||||||
export default function Login({ onReady }: { onReady: Function }) {
|
export default function Login({ onReady }: { onReady: Function }) {
|
||||||
const setAuthTokens = useSetRecoilState($authTokens);
|
const setAuthTokens = useSetRecoilState($authTokens);
|
||||||
|
|||||||
Reference in New Issue
Block a user