Files
filestash/client/model/session.js
2021-12-21 01:32:37 +11:00

29 lines
647 B
JavaScript

import { http_get, http_post, http_delete } from "../helpers/";
class SessionManager {
currentUser() {
const url = "/api/session";
return http_get(url)
.then((data) => data.result);
}
oauth2(url) {
return http_get(url)
.then((data) => data.result);
}
authenticate(params) {
const url = "/api/session";
return http_post(url, params)
.then((data) => data.result);
}
logout() {
const url = "/api/session";
return http_delete(url)
.then((data) => data.result);
}
}
export const Session = new SessionManager();