Added users rating in announcement details
This commit is contained in:
12
front/src/api/sendRate/index.ts
Normal file
12
front/src/api/sendRate/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { API_URL } from '../../config'
|
||||
import { SendRateResponse, SendRate } from './types'
|
||||
|
||||
const composeSendRateURL = () => (
|
||||
API_URL + '/user/rating?'
|
||||
)
|
||||
|
||||
const processSendRate = (data: SendRateResponse): SendRate => {
|
||||
return data.Success
|
||||
}
|
||||
|
||||
export { composeSendRateURL, processSendRate }
|
17
front/src/api/sendRate/types.ts
Normal file
17
front/src/api/sendRate/types.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { isObject } from '../../utils/types'
|
||||
|
||||
type SendRateResponse = {
|
||||
Success: boolean
|
||||
}
|
||||
|
||||
const isSendRateResponse = (obj: unknown): obj is SendRateResponse => (
|
||||
isObject(obj, {
|
||||
'Success': 'boolean',
|
||||
})
|
||||
)
|
||||
|
||||
type SendRate = boolean
|
||||
|
||||
export type { SendRateResponse, SendRate }
|
||||
|
||||
export { isSendRateResponse }
|
Reference in New Issue
Block a user