-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* replaces mock content for artist spotlight and item page * renames songs to sales to reflect data * various refactors * adds optional params to getSales endpoint * minor updates * fixes errant import * minor updates * renames currency lib * prevents song card price from wrapping * minor update to song card font size * resolves linting issues * updates approximately equal symbol * adds decimal place to newm amounts * makes additional updates to reference API data * resolves linting issue * adds comments * misc refactors * minor refactors and adds Toast component
- Loading branch information
Showing
47 changed files
with
1,132 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Maps RTKQuery API endpoint names with name that | ||
* back-end expects for recaptcha action argument. | ||
*/ | ||
export const recaptchaEndpointActionMap: Record<string, string> = { | ||
getSale: "get_sale", | ||
getSales: "get_sales", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as newmApi } from "./newm/api"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { createApi } from "@reduxjs/toolkit/query/react"; | ||
import { axiosBaseQuery } from "@newm-web/utils"; | ||
import { Tags } from "./types"; | ||
import { prepareHeaders } from "../utils"; | ||
import { baseUrls } from "../../buildParams"; | ||
|
||
export const baseQuery = axiosBaseQuery({ | ||
baseUrl: baseUrls.newm, | ||
prepareHeaders, | ||
}); | ||
|
||
const api = createApi({ | ||
baseQuery, | ||
endpoints: () => ({}), | ||
reducerPath: "newmApi", | ||
tagTypes: [Tags.Sale], | ||
}); | ||
|
||
export default api; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export enum Tags { | ||
Sale = "Sale", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { BaseQueryApi } from "@reduxjs/toolkit/dist/query/baseQueryTypes"; | ||
import { AxiosRequestConfig } from "axios"; | ||
import { executeRecaptcha } from "@newm-web/utils"; | ||
import { recaptchaEndpointActionMap } from "./constants"; | ||
|
||
/** | ||
* Returns recaptcha headers. | ||
*/ | ||
export const getRecaptchaHeaders = async (api: BaseQueryApi) => { | ||
const { endpoint } = api; | ||
const action = recaptchaEndpointActionMap[endpoint] || endpoint; | ||
|
||
return { | ||
"g-recaptcha-platform": "Web", | ||
"g-recaptcha-token": await executeRecaptcha(action), | ||
}; | ||
}; | ||
|
||
/** | ||
* Adds necessary authentication headers to requests. | ||
*/ | ||
export const prepareHeaders = async ( | ||
api: BaseQueryApi, | ||
headers: AxiosRequestConfig["headers"] | ||
) => { | ||
const recaptchaHeaders = await getRecaptchaHeaders(api); | ||
|
||
return { | ||
...recaptchaHeaders, | ||
...headers, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
...ketplace/src/app/item/[songId]/layout.tsx → ...ketplace/src/app/sale/[saleId]/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.