Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-fumix committed Jun 1, 2023
1 parent 57b6cb9 commit 168be77
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
36 changes: 20 additions & 16 deletions client/src/views/PostFormView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@
<div class="col w-50">
<div class="alert alert-warning">
{{ t("posts.form.restore") }}
<button type="button"
class="btn btn-sm btn-primary mx-3"
data-bs-toggle="collapse"
data-bs-target="#collapseTarget"
aria-expanded="true"
aria-controls="collapseTarget"
@click="restore">
<button
type="button"
class="btn btn-sm btn-primary mx-3"
data-bs-toggle="collapse"
data-bs-target="#collapseTarget"
aria-expanded="true"
aria-controls="collapseTarget"
@click="restore"
>
{{ t("app.base.restore") }}
</button>
<button type="button" class="btn btn-sm btn-danger"
data-bs-toggle="collapse"
data-bs-target="#collapseTarget"
aria-expanded="true"
aria-controls="collapseTarget"
@click="discard">
<button
type="button"
class="btn btn-sm btn-danger"
data-bs-toggle="collapse"
data-bs-target="#collapseTarget"
aria-expanded="true"
aria-controls="collapseTarget"
@click="discard"
>
{{ t("app.base.discard") }}
</button>
</div>
Expand Down Expand Up @@ -445,8 +450,7 @@ const handleFileChange = (e: Event): void => {
const discard = async () => {
const postToDiscard = foundAutosave.value as Post;
if (postToDiscard?.id) {
await PostEndpoints.deleteAutosave(postToDiscard.id)
.catch((reason) => console.log("failed to delete autosave", reason));
await PostEndpoints.deleteAutosave(postToDiscard.id).catch((reason) => console.log("failed to delete autosave", reason));
}
};

Expand All @@ -457,7 +461,7 @@ const restore = () => {
form.draft = toRestore.draft;
form.title = toRestore.title;
form.stringTags = toRestore.tags ? toRestore.tags?.map((tag) => tag.name).filter(isNeitherNullNorUndefined) : [];
tags.value = toRestore.tags ? toRestore.tags?.map((tag) => ({text: tag.name})) : [];
tags.value = toRestore.tags ? toRestore.tags?.map((tag) => ({ text: tag.name })) : [];
form.markdown = toRestore.markdown;
form.description = toRestore.description;
}
Expand Down
3 changes: 1 addition & 2 deletions client/src/views/PostView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ onMounted(async () => {
const deletePost = async (post: Post) => {
if (post.id) {
const res = await PostEndpoints.deletePost(post.id)
.catch((reason) => console.log("failed to delete autosave", reason));
const res = await PostEndpoints.deletePost(post.id).catch((reason) => console.log("failed to delete autosave", reason));
}
router.push("/posts");
};
Expand Down
19 changes: 8 additions & 11 deletions client/src/views/PostsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
<div class="col-lg-8 col-lg-border">
<div v-if="props.userPermissions?.canCreatePost" class="clearfix mb-4">
<button type="button" class="btn btn-sm btn-secondary float-end" @click="goTo('/posts/post/new')">
<fa-icon :icon="faAdd"/>
<fa-icon :icon="faAdd" />
{{ t("app.base.create_post") }}
</button>
</div>
<div v-if="loading" class="loader text-secondary">
<loading-spinner/>
<loading-spinner />
</div>
<div v-else>
Expand All @@ -34,8 +34,8 @@
></post-preview>
<div v-if="!totalPages && route.query.search" class="alert alert-light text-center">
<fa-icon :icon="faSadTear" class="mx-3"/>
{{ t("search.noResults", {query: route.query.search}) }}
<fa-icon :icon="faSadTear" class="mx-3" />
{{ t("search.noResults", { query: route.query.search }) }}
</div>
<paginate
Expand Down Expand Up @@ -95,7 +95,7 @@ const showDialog = ref<boolean>(false);
const dialogData = ref<ConfirmDialogData | null>(null);
const currentPost = ref<Post | null>(null);
const totalPages = ref<number>(1);
const {t} = useI18n();
const { t } = useI18n();
const blogTitle = ref<string>("");
const blogShortDescription = ref<string>("");
Expand Down Expand Up @@ -150,14 +150,11 @@ onMounted(() => {

const deletePost = async (post: Post) => {
if (post.id) {
const res = await PostEndpoints.deletePost(post.id)
.catch((reason) => console.log("failed to delete autosave", reason));
const res = await PostEndpoints.deletePost(post.id).catch((reason) => console.log("failed to delete autosave", reason));
}
const searchValue = (route.query?.search || "") as string;
const operator = (route.query?.operator || "and") as string;
await loadPostsWithPagination(1, searchValue, operator)
.catch((reason) => console.log("failed to load posts", reason));
;
await loadPostsWithPagination(1, searchValue, operator).catch((reason) => console.log("failed to load posts", reason));
};

const goTo = (path: string) => {
Expand All @@ -172,7 +169,7 @@ const showConfirm = (post: Post) => {
currentPost.value = post as Post;
dialogData.value = {
title: t("posts.confirm.title"),
message: t("posts.confirm.message", {post: currentPost.value.title}),
message: t("posts.confirm.message", { post: currentPost.value.title }),
};
showDialog.value = true;
};
Expand Down

0 comments on commit 168be77

Please sign in to comment.