2020-09-12 21:53:41 +00:00
|
|
|
import HTTPService from './HTTPService';
|
|
|
|
import { keyAttributes } from 'types';
|
2020-09-19 21:20:10 +00:00
|
|
|
import { getEndpoint } from 'utils/common/apiUtil';
|
2020-09-12 21:53:41 +00:00
|
|
|
|
2020-09-19 21:20:10 +00:00
|
|
|
const ENDPOINT = getEndpoint();
|
2020-09-14 09:32:01 +00:00
|
|
|
|
2021-02-16 11:45:06 +00:00
|
|
|
export interface user {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
email: string;
|
|
|
|
}
|
|
|
|
|
2020-09-12 21:53:41 +00:00
|
|
|
export const getOtt = (email: string) => {
|
2021-02-09 09:33:54 +00:00
|
|
|
return HTTPService.get(`${ENDPOINT}/users/ott`, {
|
|
|
|
email: email,
|
|
|
|
client: 'web',
|
|
|
|
});
|
|
|
|
};
|
2020-09-12 21:53:41 +00:00
|
|
|
|
|
|
|
export const verifyOtt = (email: string, ott: string) => {
|
2020-09-14 09:32:01 +00:00
|
|
|
return HTTPService.get(`${ENDPOINT}/users/credentials`, { email, ott });
|
2021-02-09 09:33:54 +00:00
|
|
|
};
|
2020-09-12 21:53:41 +00:00
|
|
|
|
2021-02-09 09:33:54 +00:00
|
|
|
export const putAttributes = (
|
|
|
|
token: string,
|
|
|
|
name: string,
|
|
|
|
keyAttributes: keyAttributes
|
|
|
|
) => {
|
|
|
|
console.log('name ' + name);
|
|
|
|
return HTTPService.put(
|
|
|
|
`${ENDPOINT}/users/attributes`,
|
|
|
|
{ name: name, keyAttributes: keyAttributes },
|
|
|
|
null,
|
|
|
|
{
|
|
|
|
'X-Auth-Token': token,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|