File size: 763 Bytes
7fc5208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { API_BASE_URL, getHeaders, handleResponse } from './util';

export interface Account {
    email: string;
    password: string;
    proofEmail: string;
}

export const accountApi = {
    async post(accounts: Account[]) {
        const response = await fetch(
            `${API_BASE_URL}/api/account`,
            {
                headers: getHeaders(),
                method: 'POST',
                body: JSON.stringify(accounts)
            }
        );
        return handleResponse(response);
    },

    async get(): Promise<Account[]> {
        const response = await fetch(
            `${API_BASE_URL}/api/account`,
            {
                headers: getHeaders()
            }
        );
        return handleResponse(response);
    },

}