<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: camo</title>
    <description>The latest articles on DEV Community by camo (@camohub).</description>
    <link>https://dev.to/camohub</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F670110%2F21fe1e5d-2b36-4576-97de-845d85df26cf.png</url>
      <title>DEV Community: camo</title>
      <link>https://dev.to/camohub</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/camohub"/>
    <language>en</language>
    <item>
      <title>How to get Pinia store inside the plugin function?</title>
      <dc:creator>camo</dc:creator>
      <pubDate>Fri, 22 Sep 2023 08:01:24 +0000</pubDate>
      <link>https://dev.to/camohub/how-to-get-pinia-store-inside-the-plugin-function-1chc</link>
      <guid>https://dev.to/camohub/how-to-get-pinia-store-inside-the-plugin-function-1chc</guid>
      <description>&lt;p&gt;I have a helpers plugin which need to access Pinia store. The plugin have access to app object as all Vue plugins. I there a way to get Pinia store object from app instance inside the plugin? The plugin looks like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//import { useAppStore } from '@/store/app'  // This does not work. Pinia is not instantiated yet
//const appStore = useAppStore()

export default {
    install: (app) =&amp;gt; {
        console.log(app)
        app.config.globalProperties.$translate = (translations, key) =&amp;gt; {

            let result = translations[key] ? translations[key][0] : ''  // First item as default value or ''

        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
