-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UP-431 - Adds product recommendations method #4
Conversation
4a59a65
to
6002b0e
Compare
.join('&'); | ||
} | ||
|
||
export async function getProductRecommendations( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are missing
src/services/recommendations.ts
Outdated
): Promise<Result<BaseProduct, HttpError>> { | ||
const inputParams = makeSearchParams(params); | ||
try { | ||
const recommendations = await get(`/recommendations${inputParams}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before search params string there should be ?
sign
fb55251
to
25a3f81
Compare
src/services/api/methods.test.ts
Outdated
import { get, post, put, patch } from './methods'; | ||
|
||
|
||
const PRODUCTS_API = 'https://products.35up.com/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be stored in env
src/services/api/methods.ts
Outdated
import { createMethod } from '@caseable/http-client'; | ||
|
||
|
||
const BASE_URL = 'https://products.35up.com/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just move APIs to env and we are good to go
src/services/api/methods.test.ts
Outdated
@@ -0,0 +1,44 @@ | |||
import { expect } from 'chai'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this was already discussed in other admin panel PR that here we are basically testing createMethod
which is a 3rd party library function.
So this test suit could be removed
@enjoythelive1 @Drafter500
src/services/recommendations-data.ts
Outdated
@@ -0,0 +1,42 @@ | |||
import { InputParameters, ProductRecommendations } from '../types'; | |||
|
|||
export const getMockRecommendations = (params: InputParameters): ProductRecommendations => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const getMockRecommendations = (params: InputParameters): ProductRecommendations => ({ | |
export const getMockRecommendations = ( | |
params: InputParameters, | |
): ProductRecommendations => ({ |
src/services/recommendations.ts
Outdated
@@ -39,3 +42,14 @@ export function makeSearchParams(input: InputParameters): string { | |||
.join('&'); | |||
} | |||
|
|||
export async function getProductRecommendations( | |||
params: InputParameters, | |||
): Promise<Result<ProductRecommendations, HttpError>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we go for Result
or RemoteData
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I incline for remote data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the mechanism to load env in the build implemented?
c927bf6
to
0b1c138
Compare
Draft: need the types from the previous PR.