Projekt

Obecné

Profil

« Předchozí | Další » 

Revize a12a4e99

Přidáno uživatelem plundrichov před více než 4 roky(ů)

re #58 mostly css edited, also login/logout

Zobrazit rozdíly:

client/src/api.js
1 1
// ******************** GET DATA APP getCurrentProfile ********************
2 2

  
3
export const logOut = async () => {
4

  
5
  let response;
6

  
7
  try {
8
    response = await fetch(
9
      `${window.config.baseUrl}/logout`, {
10
        credentials: 'include'
11
      }
12
    );    
13
  } catch (e) {
14
    throw 'Server is not available'
15
    }
16

  
17
  if (response.ok) {
18
        window.location.replace(`/logout`)
19
  } else {
20
      switch (response.status) {
21
        case 500:
22
          throw new Error('Internal server error.')
23
        default:
24
          throw new Error(response.statusText)
25
      }
26
    }
27
}
28

  
3 29
export const getCurrentProfile = async () => {
4 30

  
5 31
  let response;
......
7 33
  try {
8 34
    response = await fetch(
9 35
      `${window.config.baseUrl}/users/current/profile`, {
10
        headers: {},
36

  
11 37
        credentials: 'include'
12 38
      }
13 39
    );    

Také k dispozici: Unified diff