Skip to content

Commit

Permalink
Files correctly stored
Browse files Browse the repository at this point in the history
  • Loading branch information
Gessmass committed Nov 8, 2024
1 parent 6d7b919 commit 04d65d2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 24 deletions.
2 changes: 1 addition & 1 deletion backend/src/resolvers/UserResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class UserResolver {
}

const user = await User.findOne({
where: {id: 3},
where: {id: context.id},
relations: ['uploads', 'uploads.files'],
});

Expand Down
15 changes: 2 additions & 13 deletions frontend/src/components/user/UserLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {useUserContext} from "../../context/UserContext.tsx";

const UserLayout: FC = () => {
const navigate = useNavigate();
const {setUser} = useUserContext()
const {setUser, firstname} = useUserContext()

const [logout] = useMutation(LOGOUT, {
onCompleted: () => {
Expand Down Expand Up @@ -57,17 +57,6 @@ const UserLayout: FC = () => {
},
];

// if (loading) {
// return <p>Loading...</p>;
// }
//
// if (error || !data || !data.getConnectedUser) {
// console.log(error)
// return <p>Error loading user data.</p>;
// }
//
// console.log(data)

return (
<UserLayoutContainer>
<HeaderContainer>
Expand All @@ -77,7 +66,7 @@ const UserLayout: FC = () => {
backgroundColor: '#fde3cf',
color: '#f56a00',
cursor: 'pointer'
}}>WWW</Avatar>
}}>{firstname.charAt(0).toUpperCase()}</Avatar>
</Dropdown>
</HeaderContainer>
<Outlet/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ const UserOwnFilesTable: FC = () => {
const [shareSuccess, setShareSuccess] = useState<boolean>(false)

const {data, loading, error} = useQuery(GET_USER_FILES);

console.log(error)

const [addFilesAccessUsers, {addFilesloading}] = useMutation(ADD_FILES_ACCESS_USERS, {
onCompleted(data) {
console.log(data)
setShareSuccess(true)
}, onError(err) {
message.error(err.toString(), 3)
Expand Down
10 changes: 1 addition & 9 deletions frontend/src/context/UserContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@ interface UserContextType {
setUser: (userData: Partial<UserContextType>) => void;
}

const UserContext = createContext<UserContextType>({
isLoggedIn: false,
email: '',
setUser: (userData) => {
},
role: '',
firstname: '',
lastname: ''
});
const UserContext = createContext<UserContextType | undefined>(undefined);

export const UserProvider: FC<{ children: ReactNode }> = ({children}) => {
const [user, setUser] = useState<UserContextType>({
Expand Down

0 comments on commit 04d65d2

Please sign in to comment.