import xFetch from './xFetch';
import {serialize} from '../utils';

export async function fetch(username, password) {
    return xFetch('/api/authenticate', {
        method: 'POST',
        body: serialize({username, password})
    });
}

export async function clear() {
    sessionStorage.clear();
    return Promise.resolve();
}

export async function save(user) {
    sessionStorage.setItem('user', user);
    return Promise.resolve(user);
}


