update root folder by enviroment
This commit is contained in:
parent
2eed0f006b
commit
79b3cbe916
|
|
@ -55,7 +55,7 @@ const AllProfiles = () => {
|
|||
const [data, setData] = useState<TFileProfile[]>([])
|
||||
const [currentName, setCurrentName] = useState<string>('')
|
||||
const [openedProfile, setOpenedProfile] = useState(false)
|
||||
|
||||
const root_folder = import.meta.env.VITE_BACKEND_URL.includes('localhost') ? '/storage/profiles/' : '/image/storage/profiles/'
|
||||
function FileIcon({ name, isFolder, expanded }: FileIconProps) {
|
||||
if (name.endsWith('.pdf')) {
|
||||
return <IconFileTypePdf size={14} />
|
||||
|
|
@ -210,7 +210,7 @@ const AllProfiles = () => {
|
|||
const getAllFile = async () => {
|
||||
try {
|
||||
const res = await get(getAllFilesInProfiles, {
|
||||
root_folder: '/storage/profiles/' + currentName,
|
||||
root_folder: root_folder + currentName,
|
||||
})
|
||||
if (res.status === true) {
|
||||
setData(res.data)
|
||||
|
|
@ -231,7 +231,7 @@ const AllProfiles = () => {
|
|||
const getTree = async () => {
|
||||
try {
|
||||
const res = await get(getAllFilesInProfiles, {
|
||||
root_folder: '/storage/profiles',
|
||||
root_folder: root_folder,
|
||||
})
|
||||
if (res.status === true) {
|
||||
setTreeData(res.data)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import DataTableAll from '@/components/DataTable/DataTable'
|
|||
import PasswordRequirementInput from '@/components/PasswordRequirementInput/PasswordRequirementInput'
|
||||
import ProjectInvolvement from '@/components/ProjectInvolvement/ProjectInvolvement'
|
||||
import { logout } from '@/rtk/dispatches/auth'
|
||||
import { Xdelete } from '@/rtk/helpers/CRUD'
|
||||
import { get, post, postImage } from '@/rtk/helpers/apiService'
|
||||
import { requirementsPassword } from '@/rtk/helpers/variables'
|
||||
import { useAppDispatch, useAppSelector } from '@/rtk/hooks'
|
||||
|
|
@ -45,7 +46,6 @@ import moment from 'moment'
|
|||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import classes from './Profile.module.css'
|
||||
import { Xdelete } from '@/rtk/helpers/CRUD'
|
||||
|
||||
const isCompactMenu = false
|
||||
|
||||
|
|
@ -144,6 +144,7 @@ const Profile = () => {
|
|||
const [otherFiles, setOtherFiles] = useState([{ file: null, type: '' }])
|
||||
const [data, setData] = useState<TFileProfile[]>([])
|
||||
const [openedProfile, setOpenedProfile] = useState(false)
|
||||
const root_folder = import.meta.env.VITE_BACKEND_URL.includes('localhost') ? '/storage/profiles/' : '/image/storage/profiles/'
|
||||
const handleOtherFileChange = (
|
||||
index: number,
|
||||
field: string,
|
||||
|
|
@ -209,7 +210,7 @@ const Profile = () => {
|
|||
const getAllFile = async () => {
|
||||
try {
|
||||
const res = await get(getAllFilesInProfiles, {
|
||||
root_folder: '/storage/profiles/' + JSON.parse(getUser())?.user?.name,
|
||||
root_folder: root_folder + JSON.parse(getUser())?.user?.name,
|
||||
})
|
||||
if (res.status === true) {
|
||||
setData(res.data)
|
||||
|
|
|
|||
Loading…
Reference in New Issue