no debil no
This commit is contained in:
@@ -1,17 +1,6 @@
|
|||||||
import { ChatMessagesProps, ContactsProps } from '@/types/types.ts';
|
import { ChatMessagesProps, ContactsProps } from '@/types/types.ts';
|
||||||
import { axiosClient } from '@/utils/axiosClient.ts';
|
import { axiosClient } from '@/utils/axiosClient.ts';
|
||||||
|
|
||||||
export async function getContactsList(): Promise<ContactsProps[]> {
|
|
||||||
try {
|
|
||||||
const response = await axiosClient.get(`/api/chat/contacts`);
|
|
||||||
console.log('Get contacts list response: ', response.data);
|
|
||||||
return response.data;
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Failed to fetch /api/chat/contacts: ', e);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function sendContact(contact: string) {
|
export async function sendContact(contact: string) {
|
||||||
try {
|
try {
|
||||||
const response = await axiosClient.post(`/api/chat/contact/${contact}`);
|
const response = await axiosClient.post(`/api/chat/contact/${contact}`);
|
||||||
@@ -43,15 +32,3 @@ export async function getMessages(
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteContact(usernamecontact: string) {
|
|
||||||
try {
|
|
||||||
const response = await axiosClient.delete(
|
|
||||||
`/api/chat/contacts/${usernamecontact}`,
|
|
||||||
);
|
|
||||||
console.log(response.data);
|
|
||||||
return response.data;
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Failed to delete contact: ', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ export default function Login() {
|
|||||||
setUser({ username: res.data.username, id: res.data.user_id });
|
setUser({ username: res.data.username, id: res.data.user_id });
|
||||||
setAuthorized(true);
|
setAuthorized(true);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
console.log('redirecting');
|
|
||||||
navigate('/chat');
|
navigate('/chat');
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|||||||
@@ -136,8 +136,6 @@ app.post("/api/auth/signup", async (req, res) => {
|
|||||||
const token = generateJwtToken(username, user_id);
|
const token = generateJwtToken(username, user_id);
|
||||||
res.cookie("token", token, {
|
res.cookie("token", token, {
|
||||||
maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days
|
maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days
|
||||||
httpOnly: true,
|
|
||||||
// secure: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
|
|||||||
Reference in New Issue
Block a user