mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-11-01 10:56:31 +08:00
29 lines
627 B
JavaScript
29 lines
627 B
JavaScript
import { http_get, http_post, http_delete } from '../helpers/';
|
|
|
|
class SessionManager{
|
|
currentUser(){
|
|
let url = '/api/session'
|
|
return http_get(url)
|
|
.then(data => data.result);
|
|
}
|
|
|
|
oauth2(url){
|
|
return http_get(url)
|
|
.then(data => data.result);
|
|
}
|
|
|
|
authenticate(params){
|
|
let url = '/api/session';
|
|
return http_post(url, params)
|
|
.then(data => data.result);
|
|
}
|
|
|
|
logout(){
|
|
let url = '/api/session';
|
|
return http_delete(url)
|
|
.then(data => data.result);
|
|
}
|
|
}
|
|
|
|
export const Session = new SessionManager();
|