Skip to content

Commit

Permalink
Fixes to collectionId after it was converted to a ref.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleydavis committed Apr 28, 2024
1 parent 681ed6b commit 56005dc
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/user-interface/src/context/api-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export function ApiContextProvider({ children }: IProps) {
// Makes a full URL to a route in the REST API.
//
function makeUrl(route: string): string {
let url = `${BASE_URL}${route}&col=${collectionId}`;
let url = `${BASE_URL}${route}&col=${collectionId.current}`;
url += `&tok=${getToken()}`;
return url;
}
Expand All @@ -150,7 +150,7 @@ export function ApiContextProvider({ children }: IProps) {
throw new Error(`Collection ID is not set!`);
}

let url = `${BASE_URL}/assets?col=${collectionId}`;
let url = `${BASE_URL}/assets?col=${collectionId.current}`;

await loadToken();
const token = getToken();
Expand All @@ -170,6 +170,8 @@ export function ApiContextProvider({ children }: IProps) {
asset.group = dayjs(asset.sortDate).format("MMM, YYYY")
}

console.log(assets); //fio:

return assets;
}

Expand All @@ -183,7 +185,7 @@ export function ApiContextProvider({ children }: IProps) {

await loadToken();
const token = getToken();
const url = `${BASE_URL}/check-asset?hash=${hash}&col=${collectionId}`;
const url = `${BASE_URL}/check-asset?hash=${hash}&col=${collectionId.current}`;
const response = await axios.get(
url,
{
Expand All @@ -210,7 +212,7 @@ export function ApiContextProvider({ children }: IProps) {
const { data } = await axios.post(
`${BASE_URL}/metadata`,
{
col: collectionId,
col: collectionId.current,
fileName: uploadDetails.fileName,
width: uploadDetails.resolution.width,
height: uploadDetails.resolution.height,
Expand Down Expand Up @@ -292,7 +294,7 @@ export function ApiContextProvider({ children }: IProps) {
const token = getToken();
await axios.post(`${BASE_URL}/asset/add-label`,
{
col: collectionId,
col: collectionId.current,
id: id,
label: labelName,
},
Expand All @@ -313,7 +315,7 @@ export function ApiContextProvider({ children }: IProps) {
await axios.post(
`${BASE_URL}/asset/remove-label`,
{
col: collectionId,
col: collectionId.current,
id: id,
label: labelName,
},
Expand All @@ -334,7 +336,7 @@ export function ApiContextProvider({ children }: IProps) {
await axios.post(
`${BASE_URL}/asset/description`,
{
col: collectionId,
col: collectionId.current,
id: id,
description: description,
},
Expand Down

0 comments on commit 56005dc

Please sign in to comment.