fix #87
This commit is contained in:
parent
abda2e4025
commit
cf0d4b7c6f
5 changed files with 17 additions and 8 deletions
|
|
@ -46,7 +46,7 @@ return [
|
||||||
"pdf" => $newFile->id()
|
"pdf" => $newFile->id()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $newPage->toArray();
|
return getFileData($newFile);
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
}}
|
}}
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
v-if="comment.author.uuid === userStore.user.uuid"
|
v-if="userStore.canEditComment(comment)"
|
||||||
class="comment__ctas | mt-8"
|
class="comment__ctas | mt-8"
|
||||||
>
|
>
|
||||||
<button class="btn btn--transparent btn--icon btn--sm" data-icon="edit">
|
<button class="btn btn--transparent btn--icon btn--sm" data-icon="edit">
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore, storeToRefs } from "pinia";
|
||||||
import { ref } from "vue";
|
|
||||||
import { usePageStore } from "./page";
|
import { usePageStore } from "./page";
|
||||||
|
|
||||||
export const useBriefStore = defineStore("brief", () => {
|
export const useBriefStore = defineStore("brief", () => {
|
||||||
async function addPdf(event, briefUri, redirectToParent = false) {
|
async function addPdf(event, briefUri, redirectToParent = false) {
|
||||||
const file = event.target.files[0];
|
const file = event.target.files[0];
|
||||||
const { page } = usePageStore();
|
const { page } = storeToRefs(usePageStore());
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
@ -20,7 +19,7 @@ export const useBriefStore = defineStore("brief", () => {
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
page.value = result;
|
page.value.steps[0].files.push(result);
|
||||||
} else {
|
} else {
|
||||||
console.error("Error uploading file:", result.error);
|
console.error("Error uploading file:", result.error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,5 +24,15 @@ export const useUserStore = defineStore("user", () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return { user, notifications, readNotification, readAllNotifications };
|
function canEditComment(comment) {
|
||||||
|
return user.value.uuid === comment.author.uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
user,
|
||||||
|
notifications,
|
||||||
|
readNotification,
|
||||||
|
readAllNotifications,
|
||||||
|
canEditComment,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import Header from "../components/project/Header.vue";
|
||||||
import DialogWrapper from "../components/project/DialogWrapper.vue";
|
import DialogWrapper from "../components/project/DialogWrapper.vue";
|
||||||
import { usePageStore } from "../stores/page";
|
import { usePageStore } from "../stores/page";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { computed, watch } from "vue";
|
import { watch } from "vue";
|
||||||
import { useDialogStore } from "../stores/dialog";
|
import { useDialogStore } from "../stores/dialog";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue