refactor: make code more readable

This commit is contained in:
Sándor Levcsák 2020-11-02 13:20:45 +02:00 committed by Sándor Levcsák
parent f32fcde23a
commit 173f577b10
2 changed files with 9 additions and 9 deletions

View File

@ -59,9 +59,9 @@ export default defineComponent({
const navigationUseProps = computed(() => ({
useGlobalFeed: props.useGlobalFeed && articlesTypeInfo.value.globalFeed,
useMyFeed: props.useMyFeed && articlesTypeInfo.value.myFeed,
useTag: props.useTag ? articlesTypeInfo.value.tag ?? '' : '',
useAuthor: props.useAuthor ? articlesTypeInfo.value.author ?? '' : '',
useFavorited: props.useFavorited ? articlesTypeInfo.value.favorited ?? '' : '',
useTag: props.useTag ? articlesTypeInfo.value.tag : '',
useAuthor: props.useAuthor ? articlesTypeInfo.value.author : '',
useFavorited: props.useFavorited ? articlesTypeInfo.value.favorited : '',
}))
await fetchArticles()

View File

@ -35,9 +35,9 @@ export function useArticles () {
const articlesTypeInfo = computed(() => ({
globalFeed: true,
myFeed: isAuthorized(user),
tag: tag.value,
author: username.value,
favorited: username.value,
tag: tag.value ?? '',
author: username.value ?? '',
favorited: username.value ?? '',
}))
async function fetchArticles () {
@ -47,13 +47,13 @@ export function useArticles () {
if (articlesType.value === 'my-feed') {
responsePromise = getFeeds(page.value)
}
if (articlesType.value === 'tag' && tag?.value !== undefined) {
if (articlesType.value === 'tag' && tag.value !== undefined) {
responsePromise = getArticlesByTag(tag.value, page.value)
}
if (articlesType.value === 'profile' && username?.value !== undefined) {
if (articlesType.value === 'profile' && username.value !== undefined) {
responsePromise = getProfileArticles(username.value, page.value)
}
if (articlesType.value === 'profile-favorites' && username?.value !== undefined) {
if (articlesType.value === 'profile-favorites' && username.value !== undefined) {
responsePromise = getFavoritedArticles(username.value, page.value)
}
if (articlesType.value === 'global-feed') {