Updated poetry to use latest api
Added poem id, changed url, fixed formatting, enabled actual fetching
This commit is contained in:
@ -5,10 +5,11 @@ const initialPoetry: Poetry = {
|
||||
title: '',
|
||||
text: '',
|
||||
author: '',
|
||||
id: 0,
|
||||
}
|
||||
|
||||
const composePoetryURL = () => (
|
||||
API_URL + '/poetry?'
|
||||
API_URL + '/user/poem?'
|
||||
)
|
||||
|
||||
const processPoetry = (data: PoetryResponse): Poetry => {
|
||||
|
@ -4,6 +4,7 @@ type PoetryResponse = {
|
||||
title: string,
|
||||
text: string,
|
||||
author: string,
|
||||
id: number,
|
||||
}
|
||||
|
||||
const isPoetryResponse = (obj: unknown): obj is PoetryResponse => (
|
||||
@ -11,6 +12,7 @@ const isPoetryResponse = (obj: unknown): obj is PoetryResponse => (
|
||||
'title': 'string',
|
||||
'text': 'string',
|
||||
'author': 'string',
|
||||
'id': 'number',
|
||||
})
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user