added dynamic path in media directory for nignx host

This commit is contained in:
SanadKhan 2024-09-23 12:46:13 +05:30
parent 92cd484212
commit 67ca693ceb
1 changed files with 2 additions and 1 deletions

View File

@ -5,7 +5,8 @@ export const useMediaDirectory = () => {
if (path.indexOf('https') === 0) {
return path;
}
return `http://localhost/${path}`;
const urlWithoutPort = process.env.NEXT_PUBLIC_BACKEND_URL!.split(':').slice(0, 2).join(':');
return `${urlWithoutPort}/${path}`;
}, []);
return {