fixed create dir path again
This commit is contained in:
		
							parent
							
								
									a716b4c8cd
								
							
						
					
					
						commit
						e06d28d75e
					
				@ -1,6 +1,7 @@
 | 
			
		||||
import React from "react"
 | 
			
		||||
import { useState } from "react"
 | 
			
		||||
import { useContextMenu } from "react-contexify"
 | 
			
		||||
import normalizeDirPath from "../functions/normalizeDirPath"
 | 
			
		||||
import uploadFile from "../functions/uploadFile"
 | 
			
		||||
import { useCopyMutation, useCreateDirMutation, useDeleteDirMutation, useDeleteFileMutation, useMoveMutation, useOpenDirQuery } from "../generated/graphql"
 | 
			
		||||
import Breadcrum from "./Breadcrum"
 | 
			
		||||
@ -117,7 +118,8 @@ const FileBrowser: React.FC = () => {
 | 
			
		||||
					<div className="ml-auto">
 | 
			
		||||
						<CreateDirButton 
 | 
			
		||||
							onPressed={async (dirName)=>{
 | 
			
		||||
								await createDirMutation({variables:{path:path + dirName}})
 | 
			
		||||
								const fullPath = normalizeDirPath(normalizeDirPath(path) + dirName)
 | 
			
		||||
								await createDirMutation({variables:{path: fullPath}})
 | 
			
		||||
								refetchDir()
 | 
			
		||||
							}}
 | 
			
		||||
						/>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								src/functions/normalizeDirPath.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/functions/normalizeDirPath.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
function normalizeDirPath(path:string): string {
 | 
			
		||||
	return path.endsWith("/")?path: (path + "/")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default normalizeDirPath
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user