mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-23 01:22:00 +00:00
27 lines
805 B
TypeScript
27 lines
805 B
TypeScript
![]() |
import Base from 'ember-simple-auth/authenticators/base';
|
||
|
import { postJSON } from 'wherehows-web/utils/api/fetcher';
|
||
|
|
||
|
export default Base.extend({
|
||
|
/**
|
||
|
* Implements Base authenticator's authenticate method.
|
||
|
* Resolves with data object returned from successful request.
|
||
|
* @param {string} username username to authenticate with
|
||
|
* @param {string} password matching candidate password for username
|
||
|
* @return {Promise<{}>}
|
||
|
*/
|
||
|
authenticate: async (username: string, password: string): Promise<{}> => {
|
||
|
const { data } = await postJSON<{ data: {} }>({
|
||
|
url: '/authenticate',
|
||
|
data: { username, password }
|
||
|
});
|
||
|
|
||
|
return { ...data };
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* Implements the authenticator's restore method
|
||
|
* @return {Promise<void>}
|
||
|
*/
|
||
|
restore: () => Promise.resolve()
|
||
|
});
|