12345678910111213141516171819202122232425 |
- import { Injectable } from '@angular/core';
- import { HttpClient } from '@angular/common/http';
- @Injectable({
- providedIn: 'root'
- })
- export class ChatService {
- private apiUrl = 'https://web2023.fmode.cn/parse';
- constructor(private http: HttpClient) {}
-
- async getChatHistory(userId: string): Promise<any> {
- const url = `${this.apiUrl}/classes/Gzpmessage`;
- const query = { senderId: userId };
- const headers = { 'X-Parse-Application-Id': 'dev' };
- try {
- const response = await this.http.get(url, { headers, params: query }).toPromise();
- console.log(response)
- } catch (error) {
- throw new Error('Failed to get chat history.');
- }
- }
- }
|