dsg
INSERT INTO `cp_filejs` (`id`,`app`,`path`,`modul`,`file_name`,`content`) VALUES ('628','2','u6/driver','profile','js/view-user-profile.js---','import {\r\n getSessionUser,\r\n getUserById\r\n} from \\\\\\\\\\\\\\\"./api/auth.js\\\\\\\\\\\\\\\"\r\nimport {\r\n getUserGarage\r\n} from \\\\\\\\\\\\\\\"./api/garage.js\\\\\\\\\\\\\\\"\r\nimport {\r\n maybeFollowUser\r\n} from \\\\\\\\\\\\\\\"./api/profile.js\\\\\\\\\\\\\\\"\r\nimport app from \\\\\\\\\\\\\\\"./app.js\\\\\\\\\\\\\\\"\r\nimport {\r\n createGarageContent,\r\n displayProfile,\r\n fillGridWithPosts\r\n} from \\\\\\\\\\\\\\\"./profile.js\\\\\\\\\\\\\\\"\r\nimport store from \\\\\\\\\\\\\\\"./store.js\\\\\\\\\\\\\\\"\r\n\r\nvar $ = Dom7\r\n\r\nvar totalPostPages = 1\r\nvar totalFPostPages = 1\r\nvar currentPostPage = 1\r\nvar currentFPostPage = 1\r\n\r\nvar isFetchingPosts = false\r\nvar refreshed = false;\r\n\r\nvar userId = null\r\n\r\n$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'page:init\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.page[data-name=\\\\\\\\\\\\\\\"profile-view\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {\r\n userId = e.detail.route.params.id\r\n\r\n currentPostPage = 1\r\n currentFPostPage = 1\r\n isFetchingPosts = false\r\n refreshed = false\r\n\r\n store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'getUserPosts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', {\r\n user_id: userId,\r\n clear: true\r\n })\r\n\r\n store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'getUserTags\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', {\r\n user_id: userId,\r\n clear: true\r\n })\r\n})\r\n\r\n$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'page:beforein\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.page[data-name=\\\\\\\\\\\\\\\"profile-view\\\\\\\\\\\\\\\"]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {\r\n $(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.loading-fullscreen\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').show()\r\n\r\n var pathStore = store.getters.getPathData\r\n userId = e.detail.route.params.id\r\n\r\n const sessionUser = await getSessionUser()\r\n\r\n if (!sessionUser || !sessionUser.id) {\r\n return;\r\n }\r\n\r\n // Follow button\r\n const followButton = $(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.user-follow-btn\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n const sessionFollowings = sessionUser.following;\r\n\r\n if (sessionFollowings.includes(`${userId}`)) {\r\n followButton.text(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Following\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n } else {\r\n followButton.text(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n }\r\n\r\n followButton.attr(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'data-user-id\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', userId)\r\n\r\n let cachedData = null\r\n try {\r\n if (pathStore && pathStore.value[`/user/${userId}`]) {\r\n cachedData = pathStore.value[`/user/${userId}`]\r\n }\r\n } catch (error) {\r\n console.error(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Error fetching cached data:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', error)\r\n }\r\n\r\n await renderProfileData(cachedData, userId)\r\n})\r\n\r\n$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'click\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.user-follow-btn\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function () {\r\n const followButton = $(this)\r\n const isFollowing = followButton.text() === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Following\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\r\n\r\n // change the button text\r\n followButton.text(isFollowing ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Follow\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Following\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n const response = await maybeFollowUser(followButton.attr(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'data-user-id\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'))\r\n\r\n if (response && response.success) {\r\n store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'updateUserDetails\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', {\r\n external: true\r\n })\r\n }\r\n})\r\n\r\nasync function renderProfileData(cachedData, userId) {\r\n // if (!refreshed && !cachedData) {\r\n // }\r\n\r\n refreshed = false\r\n\r\n if (!cachedData) {\r\n const data = await getUserById(userId)\r\n console.log(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'User data:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', data);\r\n\r\n if (!data || data.error) {\r\n $(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.loading-fullscreen\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').hide()\r\n app.dialog.alert(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'User not found\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Error\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n\r\n view.router.back(view.history[0], {\r\n force: true\r\n })\r\n return\r\n }\r\n\r\n const garage = await getUserGarage(userId)\r\n\r\n if (garage) {\r\n createGarageContent(garage, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.pview-current-vehicles-list\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.pview-past-vehicles-list\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n }\r\n\r\n // Assuming `path` is a dynamic path like \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'/garage/2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\r\n store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'setPathData\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', {\r\n path: `/user/${userId}`,\r\n data: {\r\n user: data.user,\r\n garage: garage,\r\n },\r\n })\r\n\r\n displayProfile(data.user, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'profile-view\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n } else {\r\n displayProfile(cachedData.user, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'profile-view\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n\r\n if (cachedData.garage) {\r\n createGarageContent(cachedData.garage, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.pview-current-vehicles-list\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.pview-past-vehicles-list\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n }\r\n }\r\n\r\n $(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.loading-fullscreen\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').hide()\r\n}\r\n\r\nfunction populateUsersPosts(data) {\r\n if (data) {\r\n const postsKey = `user-${userId}-posts`\r\n //const tagsKey = `user-${userId}-tags`\r\n\r\n // Handle posts\r\n if (data[postsKey]) {\r\n totalPostPages = data[postsKey].total_pages || 0\r\n\r\n let reset = data[postsKey].cleared || false\r\n\r\n console.log(reset);\r\n\r\n // Only update the DOM if there are new posts\r\n if (data[postsKey].new_data && data[postsKey].new_data.length > 0) {\r\n fillGridWithPosts(data[postsKey].new_data, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'profile-view-grid-posts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', reset)\r\n // Clear new_data after processing to avoid re-rendering\r\n\r\n data[postsKey].new_data = []\r\n }\r\n\r\n if ((data[postsKey].page === totalPostPages) || (totalPostPages == 0)) {\r\n // hide preloader\r\n $(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.infinite-scroll-preloader.posts-tab.view-profile\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').hide()\r\n }\r\n\r\n if (data[postsKey].data.length === 0) {\r\n const profileGrid = document.getElementById(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'profile-view-grid-posts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n profileGrid.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'

No posts

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\r\n return;\r\n }\r\n\r\n }\r\n\r\n // Handle tags\r\n /*\r\n if (data[tagsKey]) {\r\n totalFPostPages = data[tagsKey].total_pages || 0\r\n\r\n let reset = data[tagsKey].cleared || false\r\n\r\n // Only update the DOM if there are new tags\r\n if (data[tagsKey].new_data && data[tagsKey].new_data.length > 0) {\r\n fillGridWithPosts(data[tagsKey].new_data, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'profile-view-grid-tags\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', reset)\r\n // Clear new_data after processing to avoid re-rendering\r\n data[tagsKey].new_data = []\r\n }\r\n\r\n if ((data[tagsKey].page === totalFPostPages) || (totalFPostPages == 0)) {\r\n // hide preloader\r\n $(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.infinite-scroll-preloader.tags-tab.view-profile\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').hide()\r\n }\r\n /*\r\n if (data[tagsKey].data.length === 0) {\r\n const profileGrid = document.getElementById(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'profile-view-grid-tags\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n profileGrid.innerHTML = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'

No tagged posts

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\r\n return;\r\n }\r\n --\r\n }*/\r\n }\r\n}\r\n\r\nstore.getters.getUserPathUpdated.onUpdated(() => {\r\n const data = store.getters.getUserPathData.value\r\n populateUsersPosts(data)\r\n})\r\n\r\n$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'infinite\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.profile-landing-page.infinite-scroll-content.view-page\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {\r\n if (isFetchingPosts) return\r\n\r\n const activeTab = document.querySelector(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.profile-tabs .tab-link-active\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\r\n const activeTabId = activeTab.id\r\n\r\n if (!activeTabId || activeTabId === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'my-garage\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') return\r\n\r\n const getterFunc = activeTabId === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'my-posts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'getUserPosts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'getUserTags\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\r\n\r\n isFetchingPosts = true\r\n\r\n if (activeTabId === \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'my-posts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') {\r\n currentPostPage++\r\n if (currentPostPage <= totalPostPages) {\r\n await store.dispatch(getterFunc, {\r\n user_id: userId,\r\n page: currentPostPage\r\n })\r\n isFetchingPosts = false\r\n }\r\n } else {\r\n currentFPostPage++\r\n\r\n if (currentFPostPage <= totalFPostPages) {\r\n await store.dispatch(getterFunc, {\r\n user_id: userId,\r\n page: currentFPostPage\r\n })\r\n isFetchingPosts = false\r\n }\r\n }\r\n})\r\n\r\n$(document).on(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'ptr:refresh\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.profile-landing-page.view-page.ptr-content\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', async function (e) {\r\n try {\r\n currentPostPage = 1\r\n currentFPostPage = 1\r\n\r\n store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'removePathData\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', `/user/${userId}`)\r\n\r\n await renderProfileData(null, userId)\r\n\r\n store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'getUserPosts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', {\r\n user_id: userId,\r\n clear: true\r\n })\r\n\r\n store.dispatch(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'getUserTags\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', {\r\n user_id: userId,\r\n clear: true\r\n })\r\n\r\n refreshed = true\r\n } catch (error) {\r\n console.log(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Error refreshing profile page:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', error);\r\n }\r\n\r\n app.ptr.get(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.profile-landing-page.view-page.ptr-content\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').done()\r\n})');
Copy This

Warning: file_get_contents(/home/u340524018/domains/agniaga.com/public_html/sub/u6/driver/js/view-user-profile.js---): Failed to open stream: No such file or directory in /home/u340524018/domains/agniaga.com/public_html/sub/u2/cp/inc.filejs.php on line 190
import {
    getSessionUser,
    getUserById
} from \\\\\\\"./api/auth.js\\\\\\\"
import {
    getUserGarage
} from \\\\\\\"./api/garage.js\\\\\\\"
import {
    maybeFollowUser
} from \\\\\\\"./api/profile.js\\\\\\\"
import app from \\\\\\\"./app.js\\\\\\\"
import {
    createGarageContent,
    displayProfile,
    fillGridWithPosts
} from \\\\\\\"./profile.js\\\\\\\"
import store from \\\\\\\"./store.js\\\\\\\"

var $ = Dom7

var totalPostPages = 1
var totalFPostPages = 1
var currentPostPage = 1
var currentFPostPage = 1

var isFetchingPosts = false
var refreshed = false;

var userId = null

$(document).on(\\\\\\\\\\\\\\\'page:init\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\'.page[data-name=\\\\\\\"profile-view\\\\\\\"]\\\\\\\\\\\\\\\', async function (e) {
    userId = e.detail.route.params.id

    currentPostPage = 1
    currentFPostPage = 1
    isFetchingPosts = false
    refreshed = false

    store.dispatch(\\\\\\\\\\\\\\\'getUserPosts\\\\\\\\\\\\\\\', {
        user_id: userId,
        clear: true
    })

    store.dispatch(\\\\\\\\\\\\\\\'getUserTags\\\\\\\\\\\\\\\', {
        user_id: userId,
        clear: true
    })
})

$(document).on(\\\\\\\\\\\\\\\'page:beforein\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\'.page[data-name=\\\\\\\"profile-view\\\\\\\"]\\\\\\\\\\\\\\\', async function (e) {
    $(\\\\\\\\\\\\\\\'.loading-fullscreen\\\\\\\\\\\\\\\').show()

    var pathStore = store.getters.getPathData
    userId = e.detail.route.params.id

    const sessionUser = await getSessionUser()

    if (!sessionUser || !sessionUser.id) {
        return;
    }

    // Follow button
    const followButton = $(\\\\\\\\\\\\\\\'.user-follow-btn\\\\\\\\\\\\\\\')
    const sessionFollowings = sessionUser.following;

    if (sessionFollowings.includes(`${userId}`)) {
        followButton.text(\\\\\\\\\\\\\\\'Following\\\\\\\\\\\\\\\')
    } else {
        followButton.text(\\\\\\\\\\\\\\\'Follow\\\\\\\\\\\\\\\')
    }

    followButton.attr(\\\\\\\\\\\\\\\'data-user-id\\\\\\\\\\\\\\\', userId)

    let cachedData = null
    try {
        if (pathStore && pathStore.value[`/user/${userId}`]) {
            cachedData = pathStore.value[`/user/${userId}`]
        }
    } catch (error) {
        console.error(\\\\\\\\\\\\\\\'Error fetching cached data:\\\\\\\\\\\\\\\', error)
    }

    await renderProfileData(cachedData, userId)
})

$(document).on(\\\\\\\\\\\\\\\'click\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\'.user-follow-btn\\\\\\\\\\\\\\\', async function () {
    const followButton = $(this)
    const isFollowing = followButton.text() === \\\\\\\\\\\\\\\'Following\\\\\\\\\\\\\\\'

    // change the button text
    followButton.text(isFollowing ? \\\\\\\\\\\\\\\'Follow\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\'Following\\\\\\\\\\\\\\\')
    const response = await maybeFollowUser(followButton.attr(\\\\\\\\\\\\\\\'data-user-id\\\\\\\\\\\\\\\'))

    if (response && response.success) {
        store.dispatch(\\\\\\\\\\\\\\\'updateUserDetails\\\\\\\\\\\\\\\', {
            external: true
        })
    }
})

async function renderProfileData(cachedData, userId) {
    // if (!refreshed && !cachedData) {
    // }

    refreshed = false

    if (!cachedData) {
        const data = await getUserById(userId)
        console.log(\\\\\\\\\\\\\\\'User data:\\\\\\\\\\\\\\\', data);

        if (!data || data.error) {
            $(\\\\\\\\\\\\\\\'.loading-fullscreen\\\\\\\\\\\\\\\').hide()
            app.dialog.alert(\\\\\\\\\\\\\\\'User not found\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\'Error\\\\\\\\\\\\\\\')

            view.router.back(view.history[0], {
                force: true
            })
            return
        }

        const garage = await getUserGarage(userId)

        if (garage) {
            createGarageContent(garage, \\\\\\\\\\\\\\\'.pview-current-vehicles-list\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\'.pview-past-vehicles-list\\\\\\\\\\\\\\\')
        }

        // Assuming `path` is a dynamic path like \\\\\\\\\\\\\\\'/garage/2\\\\\\\\\\\\\\\'
        store.dispatch(\\\\\\\\\\\\\\\'setPathData\\\\\\\\\\\\\\\', {
            path: `/user/${userId}`,
            data: {
                user: data.user,
                garage: garage,
            },
        })

        displayProfile(data.user, \\\\\\\\\\\\\\\'profile-view\\\\\\\\\\\\\\\')
    } else {
        displayProfile(cachedData.user, \\\\\\\\\\\\\\\'profile-view\\\\\\\\\\\\\\\')

        if (cachedData.garage) {
            createGarageContent(cachedData.garage, \\\\\\\\\\\\\\\'.pview-current-vehicles-list\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\'.pview-past-vehicles-list\\\\\\\\\\\\\\\')
        }
    }

    $(\\\\\\\\\\\\\\\'.loading-fullscreen\\\\\\\\\\\\\\\').hide()
}

function populateUsersPosts(data) {
    if (data) {
        const postsKey = `user-${userId}-posts`
        //const tagsKey = `user-${userId}-tags`

        // Handle posts
        if (data[postsKey]) {
            totalPostPages = data[postsKey].total_pages || 0

            let reset = data[postsKey].cleared || false

            console.log(reset);

            // Only update the DOM if there are new posts
            if (data[postsKey].new_data && data[postsKey].new_data.length > 0) {
                fillGridWithPosts(data[postsKey].new_data, \\\\\\\\\\\\\\\'profile-view-grid-posts\\\\\\\\\\\\\\\', reset)
                // Clear new_data after processing to avoid re-rendering

                data[postsKey].new_data = []
            }

            if ((data[postsKey].page === totalPostPages) || (totalPostPages == 0)) {
                // hide preloader
                $(\\\\\\\\\\\\\\\'.infinite-scroll-preloader.posts-tab.view-profile\\\\\\\\\\\\\\\').hide()
            }

            if (data[postsKey].data.length === 0) {
                const profileGrid = document.getElementById(\\\\\\\\\\\\\\\'profile-view-grid-posts\\\\\\\\\\\\\\\')
                profileGrid.innerHTML = \\\\\\\\\\\\\\\'<p></p><p>No posts</p>\\\\\\\\\\\\\\\'
                return;
            }

        }

        // Handle tags
        /*
        if (data[tagsKey]) {
            totalFPostPages = data[tagsKey].total_pages || 0

            let reset = data[tagsKey].cleared || false

            // Only update the DOM if there are new tags
            if (data[tagsKey].new_data && data[tagsKey].new_data.length > 0) {
                fillGridWithPosts(data[tagsKey].new_data, \\\\\\\\\\\\\\\'profile-view-grid-tags\\\\\\\\\\\\\\\', reset)
                // Clear new_data after processing to avoid re-rendering
                data[tagsKey].new_data = []
            }

            if ((data[tagsKey].page === totalFPostPages) || (totalFPostPages == 0)) {
                // hide preloader
                $(\\\\\\\\\\\\\\\'.infinite-scroll-preloader.tags-tab.view-profile\\\\\\\\\\\\\\\').hide()
            }
            /*
            if (data[tagsKey].data.length === 0) {
                const profileGrid = document.getElementById(\\\\\\\\\\\\\\\'profile-view-grid-tags\\\\\\\\\\\\\\\')
                profileGrid.innerHTML = \\\\\\\\\\\\\\\'<p></p><p>No tagged posts</p>\\\\\\\\\\\\\\\'
                return;
            }
            --
        }*/
    }
}

store.getters.getUserPathUpdated.onUpdated(() => {
    const data = store.getters.getUserPathData.value
    populateUsersPosts(data)
})

$(document).on(\\\\\\\\\\\\\\\'infinite\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\'.profile-landing-page.infinite-scroll-content.view-page\\\\\\\\\\\\\\\', async function (e) {
    if (isFetchingPosts) return

    const activeTab = document.querySelector(\\\\\\\\\\\\\\\'.profile-tabs .tab-link-active\\\\\\\\\\\\\\\')
    const activeTabId = activeTab.id

    if (!activeTabId || activeTabId === \\\\\\\\\\\\\\\'my-garage\\\\\\\\\\\\\\\') return

    const getterFunc = activeTabId === \\\\\\\\\\\\\\\'my-posts\\\\\\\\\\\\\\\' ? \\\\\\\\\\\\\\\'getUserPosts\\\\\\\\\\\\\\\' : \\\\\\\\\\\\\\\'getUserTags\\\\\\\\\\\\\\\'

    isFetchingPosts = true

    if (activeTabId === \\\\\\\\\\\\\\\'my-posts\\\\\\\\\\\\\\\') {
        currentPostPage++
        if (currentPostPage <= totalPostPages) {
            await store.dispatch(getterFunc, {
                user_id: userId,
                page: currentPostPage
            })
            isFetchingPosts = false
        }
    } else {
        currentFPostPage++

        if (currentFPostPage <= totalFPostPages) {
            await store.dispatch(getterFunc, {
                user_id: userId,
                page: currentFPostPage
            })
            isFetchingPosts = false
        }
    }
})

$(document).on(\\\\\\\\\\\\\\\'ptr:refresh\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\'.profile-landing-page.view-page.ptr-content\\\\\\\\\\\\\\\', async function (e) {
    try {
        currentPostPage = 1
        currentFPostPage = 1

        store.dispatch(\\\\\\\\\\\\\\\'removePathData\\\\\\\\\\\\\\\', `/user/${userId}`)

        await renderProfileData(null, userId)

        store.dispatch(\\\\\\\\\\\\\\\'getUserPosts\\\\\\\\\\\\\\\', {
            user_id: userId,
            clear: true
        })

        store.dispatch(\\\\\\\\\\\\\\\'getUserTags\\\\\\\\\\\\\\\', {
            user_id: userId,
            clear: true
        })

        refreshed = true
    } catch (error) {
        console.log(\\\\\\\\\\\\\\\'Error refreshing profile page:\\\\\\\\\\\\\\\', error);
    }

    app.ptr.get(\\\\\\\\\\\\\\\'.profile-landing-page.view-page.ptr-content\\\\\\\\\\\\\\\').done()
})
Add JS Function Name