Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dado555 committed Aug 23, 2022
1 parent 29f6bb6 commit fa1c4b9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 130 deletions.
1 change: 0 additions & 1 deletion gleficu-frontend/src/components/comments/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export default {
alert("Comment deleted!");
this.$emit("deletedComment")
});
// emit event to refresh comments
},
addComplaint() {
let userId = parseInt(this.getUserId());
Expand Down
38 changes: 6 additions & 32 deletions gleficu-frontend/src/components/header/AccountDropDown.vue
Original file line number Diff line number Diff line change
@@ -1,39 +1,19 @@
<template>
<div class="relative" style="margin-right: 50px">
<button @click="isOpen = !isOpen" class="focus:outline-none">
<img
src="@/assets/images/avatar.jpg"
alt=""
class="h-10 rounded-full mr-1"
/>
<img src="@/assets/images/avatar.jpg" alt="" class="h-10 rounded-full mr-1"/>
</button>

<button
@click="isOpen = false"
v-if="isOpen"
class="fixed top-0 right-0 bottom-0 w-full h-full cursor-default bg-black opacity-50 "
></button>
<button @click="isOpen = false" v-if="isOpen"
class="fixed top-0 right-0 bottom-0 w-full h-full cursor-default bg-black opacity-50 "></button>

<div
v-if="isOpen"
class="absolute bg-white py-2 rounded-lg w-48 right-0 mr-3 shadow-xl"
>
<a
v-if="isUser()"
<div v-if="isOpen" class="absolute bg-white py-2 rounded-lg w-48 right-0 mr-3 shadow-xl">
<a v-if="isUser()"
@click="redirectProfile()"
class="text-gray-500 block px-4 py-2 hover:bg-indigo-500 hover:text-white"
>Account Settings
</a>
<!-- Redirect to -->
<!-- /user/:id -->

<!-- <a-->
<!-- v-if="loggedIn === true"-->
<!-- class="text-gray-500 block px-4 py-2 hover:bg-indigo-500 hover:text-white"-->
<!-- >Support-->
<!-- </a>-->
<a
@click.prevent="logout"
<a @click.prevent="logout"
v-if="!isUnauthorized()"
class="text-gray-500 block px-4 py-2 hover:bg-indigo-500 hover:text-white"
>Logout
Expand All @@ -54,13 +34,7 @@ export default {
mounted() {
if(authService.isAuthenticated()) {
this.loggedIn = true;
// this.roles = authService.getRoles();
}
// this.$root.$on("loginSuccess", (roles) => {
// this.loggedIn = true;
// this.roles = roles;
// })
},
created() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,7 @@ export default {
tempAttachments: [],
attachments: [],
dropzoneOptions: {
// The Url Where Dropped or Selected files will be sent
//url: `https://httpbin.org/post`,
// File Size allowed in MB
//maxFilesize: 102400000,
// Authentication Headers like Access_Token of your application
// headers: {
// Authorization: `Access Token`
// },
// The way you want to receive the files in the server
// paramName: function() { // n
// return "file[]";
// },
// important : set autoProcessQueue on false
autoProcessQueue: false,
// url
url: 'http://localhost',
dictDefaultMessage: "Upload Files Here xD",
includeStyling: false,
Expand All @@ -206,21 +191,7 @@ export default {
AttachmentList: AttachmentList
},
methods: {
// function called for every file dropped or selected
fileAdded(file) {
//console.log("File Dropped => ", file);
//console.log(this.$refs.myVueDropzone.getQueuedFiles());
//console.log(this.$refs.myVueDropzone.getAcceptedFiles());
// const reader = new FileReader()
// reader.readAsDataURL(file)
//
// reader.onload = function(event) {
// console.log(event.target.result);
// console.log(event);
// };
// Construct your file object to render in the UI
let attachment = {};
attachment._id = file.upload.uuid;
attachment.title = file.name;
Expand All @@ -236,7 +207,6 @@ export default {
this.tempAttachments = [...this.tempAttachments, attachment];
if(this.tempAttachments.length > 1)
this.passForMerge(this.tempAttachments);
//getAcceptedFiles()[0].dataURL);//your origin image data url
},
getUrl(file, dataUrl) {
console.log(file);
Expand All @@ -259,23 +229,18 @@ export default {
console.log(response);
});
},
// a middle layer function where you can change the XHR request properties
sendingFiles(files, ) { // xhr, formData
console.log(
"if you want to change the upload time or add data to the formData you can do it here."
);
sendingFiles(files) {
console.log("if you want to change the upload time or add data to the formData you can do it here.");
console.log("Files sending", files);
},
// function where we get the upload progress
uploadProgress(file, progress, ) { // bytesSent
uploadProgress(file, progress) {
console.log("File Upload Progress", progress);
this.tempAttachments.map(attachment => {
if (attachment.title === file.name) {
attachment.progress = `${Math.floor(progress)}`;
}
});
},
// called on successful upload of a file
success(file, response) {
console.log("File uploaded successfully");
console.log("Response is ->", response);
Expand All @@ -301,7 +266,6 @@ export default {
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
#mergeMovie {
margin-top: 60px;
Expand Down
21 changes: 2 additions & 19 deletions gleficu-frontend/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,8 @@ import UserDetail from "@/components/users/UserDetail";
import NewMoviePage from "@/components/movies/createMovie/NewMoviePage";
import Attachment from "@/components/mergeMovieAndSubtitle/Attachment";
import RecommendMeMovie from "@/components/users/RecommendMeMovie";

// const roles = { USER, ADMIN.. };

// import { authService } from "./services/authService"
import Login from "@/components/Login";

// function requireAuth (to, from, next) {
// if (!authService.isAuthenticated()) {
// this.$router.replace('/login')
// } else {
// next()
// }
// }

let router = new VueRouter({
mode: "history",
Expand Down Expand Up @@ -49,8 +38,8 @@ let router = new VueRouter({
name: "mergeMovie",
component: Attachment,
meta: {
authenticated: false, // true
authorities: [], // "USER"
authenticated: true,
authorities: ["USER"],
}
},
{
Expand Down Expand Up @@ -99,12 +88,6 @@ let router = new VueRouter({
name: 'login',
component: Login
},
// {
// path: '/userinfo',
// name: 'userinfo',
// component: UserInfo,
// beforeEnter: requireAuth
// }
],
});

Expand Down
39 changes: 0 additions & 39 deletions gleficu-frontend/src/services/commentService.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ class CommentService {
);
}

// pub struct Comment {
// pub id: i32,
// pub movie_id: String,
// pub user_id: i32,
// pub created_at: String,
// pub updated_at: String,
// pub deleted_at: String,
// pub text: String,
// pub like_stars: i32,
// pub reports_number: i32
// }

getBadCommentsByUser(userId) {
return axios.get(GET_BAD_COMMENTS_FOR_USER + `?user_id=${userId}`,
{
Expand Down Expand Up @@ -65,13 +53,6 @@ class CommentService {
);
}

// pub struct CommentCreationDTO {
// pub movie_id: String,
// pub user_id: i32,
// pub text: String,
// pub like_stars: i32
// }

deleteComment(commentId) {
return axios.delete(DELETE_COMMENT + `?comment_id=${commentId}`,
{
Expand All @@ -92,13 +73,6 @@ class CommentService {
);
}

// pub struct CommentUpdateDTO {
// pub id: i32,
// pub text: String,
// pub like_stars: i32,
// pub reports_number: i32
// }

addComplaint(complaint_creation_dto) {
return axios.post(ADD_COMPLAINT, complaint_creation_dto,
{
Expand All @@ -109,11 +83,6 @@ class CommentService {
);
}

// pub struct ReportCreateDTO {
// pub comment_id: i32,
// pub user_id: i32
// }

getComplaint(userId, commentId) {
return axios.get(GET_COMPLAINT + `?user_id=${userId}&comment_id=${commentId}`,
{
Expand All @@ -124,14 +93,6 @@ class CommentService {
);
}

// pub struct Report {
// pub id: i32,
// pub comment_id: i32,
// pub user_id: i32,
// pub created_at: String,
// pub deleted_at: String
// }

deleteComplaint(complaintId, commentId) {
return axios.delete(DELETE_COMPLAINT + `?complaint_id=${complaintId}&comment_id=${commentId}`,
{
Expand Down

0 comments on commit fa1c4b9

Please sign in to comment.