30 if (token) {
31 // Verify token is still valid by making a test request
32 fetch('/api/users/favorites', {
33 headers: { 'Authorization': `Bearer ${token}` }
34 })
70 });
71
72 const response = await fetch(`/api/apartments/search?${queryParams}`);
73 const data = await response.json();
74
24 return c.json<ApiResponse>({
25 success: false,
26 error: "Failed to fetch settings"
27 }, 500);
28 }
201 return c.json<ApiResponse>({
202 success: false,
203 error: "Failed to fetch setting category"
204 }, 500);
205 }
33 return c.json<ApiResponse>({
34 success: false,
35 error: "Failed to fetch groups"
36 }, 500);
37 }
142 return c.json<ApiResponse>({
143 success: false,
144 error: "Failed to fetch group details"
145 }, 500);
146 }
31 const loadMessages = async () => {
32 try {
33 const response = await fetch(`/api/chat/${chat.id}/messages`, {
34 headers: { 'Authorization': `Bearer ${token}` }
35 });
50 const loadGroupDetails = async () => {
51 try {
52 const response = await fetch(`/api/groups/${chat.id}`, {
53 headers: { 'Authorization': `Bearer ${token}` }
54 });
77
78 try {
79 const response = await fetch(`/api/chat/${chat.id}/messages`, {
80 method: 'POST',
81 headers: {
24 return c.json<ApiResponse>({
25 success: false,
26 error: "Failed to fetch contacts"
27 }, 500);
28 }
29 const loadMessages = async () => {
30 try {
31 const response = await fetch(`/api/chat/${chat.id}/messages`, {
32 headers: { 'Authorization': `Bearer ${token}` }
33 });
58
59 try {
60 const response = await fetch(`/api/chat/${chat.id}/messages`, {
61 method: 'POST',
62 headers: {
31 return c.json<ApiResponse>({
32 success: false,
33 error: "Failed to fetch chats"
34 }, 500);
35 }
128 return c.json<ApiResponse>({
129 success: false,
130 error: "Failed to fetch messages"
131 }, 500);
132 }
248 return c.json<ApiResponse>({
249 success: false,
250 error: "Failed to fetch chat details"
251 }, 500);
252 }
35 const loadChats = async () => {
36 try {
37 const response = await fetch('/api/chat', {
38 headers: { 'Authorization': `Bearer ${token}` }
39 });
54 const loadContacts = async () => {
55 try {
56 const response = await fetch('/api/contacts', {
57 headers: { 'Authorization': `Bearer ${token}` }
58 });
89 const handleNewChat = async (contactId: string) => {
90 try {
91 const response = await fetch('/api/chat/individual', {
92 method: 'POST',
93 headers: {
113 const handleNewGroup = async (name: string, memberIds: string[]) => {
114 try {
115 const response = await fetch('/api/groups', {
116 method: 'POST',
117 headers: {
22 const loadPosts = async () => {
23 try {
24 const response = await fetch('/api/chatroom/posts', {
25 headers: { 'Authorization': `Bearer ${token}` }
26 });
294 .filter(tag => tag.length > 0);
295
296 const response = await fetch('/api/chatroom/posts', {
297 method: 'POST',
298 headers: {
460
461 try {
462 const response = await fetch(`/api/chatroom/posts/${post.id}/replies`, {
463 method: 'POST',
464 headers: {
37 return c.json<ApiResponse>({
38 success: false,
39 error: "Failed to fetch posts"
40 }, 500);
41 }
129 return c.json<ApiResponse>({
130 success: false,
131 error: "Failed to fetch post"
132 }, 500);
133 }
192 return c.json<ApiResponse>({
193 success: false,
194 error: "Failed to fetch replies"
195 }, 500);
196 }