ente/src/services/userService.ts

39 lines
882 B
TypeScript
Raw Normal View History

import HTTPService from './HTTPService';
import { keyAttributes } from 'types';
import { getEndpoint } from 'utils/common/apiUtil';
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;
}
export const getOtt = (email: string) => {
return HTTPService.get(`${ENDPOINT}/users/ott`, {
email: email,
client: 'web',
});
};
export const verifyOtt = (email: string, ott: string) => {
2020-09-14 09:32:01 +00:00
return HTTPService.get(`${ENDPOINT}/users/credentials`, { email, ott });
};
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,
}
);
};