2022-03-07 21:52:21 +01:00
|
|
|
import { get, post, put } from './base';
|
|
|
|
|
2022-03-22 13:48:20 +01:00
|
|
|
// not used. kept as a placeholder for reference while implementing license key stuff
|
2022-03-07 21:52:21 +01:00
|
|
|
const AuthApi = {
|
2022-03-08 20:45:26 +01:00
|
|
|
whoami: () => get('auth/v1/user/whoami'),
|
|
|
|
signup: (params) => post('auth/v1/user/signup', params),
|
|
|
|
login: (params) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
const { ipcRenderer } = window.require("electron");
|
|
|
|
|
|
|
|
ipcRenderer.invoke('grafnode-account-request', {
|
|
|
|
data: params,
|
|
|
|
method: 'POST',
|
|
|
|
url: `${process.env.NEXT_PUBLIC_GRAFNODE_SERVER_API}/auth/v1/user/login`,
|
|
|
|
})
|
|
|
|
.then(resolve)
|
|
|
|
.catch(reject);
|
|
|
|
});
|
2022-03-22 13:48:20 +01:00
|
|
|
}
|
2022-03-07 21:52:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default AuthApi;
|