Updated user to use latest api

This commit is contained in:
2023-08-08 18:32:14 +03:00
parent 60779ea489
commit f432193508
5 changed files with 35 additions and 50 deletions

View File

@ -1,19 +1,11 @@
import { API_URL } from '../../config'
import { UserResponse, User } from './types'
import { faker } from '@faker-js/faker/locale/ru'
const initialUser: User = import.meta.env.DEV ? { // Temporary, until api is realized
id: Math.random() * 100,
name: faker.person.firstName() + ' ' + faker.person.lastName(),
regDate: faker.date.anytime().getTime(),
points: Math.round(Math.random() * 1000),
} : {
id: 1,
name: 'Вася пупкин',
regDate: 0,
points: 100,
const initialUser: User = {
id: -1,
nickname: '',
regDate: '',
points: -1,
}
const composeUserURL = () => (
@ -21,7 +13,10 @@ const composeUserURL = () => (
)
const processUser = (data: UserResponse): User => {
return data
return {
...data,
regDate: data.reg_date,
}
}
export { initialUser, composeUserURL, processUser }