github.com/argoproj/argo-cd@v1.8.7/ui/src/app/shared/services/user-service.ts (about)

     1  import {UserInfo} from '../models';
     2  import requests from './requests';
     3  
     4  export class UserService {
     5      public login(username: string, password: string): Promise<{token: string}> {
     6          return requests
     7              .post('/session')
     8              .send({username, password})
     9              .then(res => ({token: res.body.token}));
    10      }
    11  
    12      public logout(): Promise<boolean> {
    13          return requests.delete('/session').then(() => true);
    14      }
    15  
    16      public get(): Promise<UserInfo> {
    17          return requests.get('/session/userinfo').then(res => res.body as UserInfo);
    18      }
    19  }