@angular/common/http#HttpContext TypeScript Examples
The following examples show how to use
@angular/common/http#HttpContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: chatroom.service.ts From onchat-web with Apache License 2.0 | 6 votes |
/**
* 获取聊天室
* @param id 聊天室ID
*/
getChatroom(id: number): Observable<Result<Chatroom>> {
return this.http.get<Result<Chatroom>>(`${environment.chatroomCtx}/${id}`, {
context: new HttpContext().set(HTTP_CACHE_TOKEN, 600000)
});
}
Example #2
Source File: chatroom.service.ts From onchat-web with Apache License 2.0 | 6 votes |
/**
* 获取群聊成员
* @param id 聊天室ID
*/
getChatMembers(id: number): Observable<Result<ChatMember[]>> {
return this.http.get<Result<ChatMember[]>>(`${environment.chatroomCtx}/${id}/members`, {
context: new HttpContext().set(HTTP_CACHE_TOKEN, 600000)
});
}
Example #3
Source File: index.service.ts From onchat-web with Apache License 2.0 | 6 votes |
/**
* 检测用户名是否可用
* @param username 用户名
*/
checkUsername(username: string): Observable<Result<boolean>> {
return this.http.get<Result<boolean>>(environment.indexCtx + '/checkusername', {
params: { username },
context: new HttpContext().set(HTTP_CACHE_TOKEN, 5000)
});
}
Example #4
Source File: index.service.ts From onchat-web with Apache License 2.0 | 6 votes |
/**
* 检测邮箱是否可用
* @param email 邮箱
*/
checkEmail(email: string): Observable<Result<boolean>> {
return this.http.get<Result<boolean>>(environment.indexCtx + '/checkemail', {
params: { email },
context: new HttpContext().set(HTTP_CACHE_TOKEN, 5000)
});
}
Example #5
Source File: user.service.ts From onchat-web with Apache License 2.0 | 6 votes |
/**
* 通过用户ID获取用户
* @param userId 用户ID
*/
getUser(userId: number): Observable<Result<User>> {
return this.http.get<Result<User>>(`${environment.userCtx}/${userId}`, {
context: new HttpContext().set(HTTP_CACHE_TOKEN, 600000)
});
}