# Nuxt.js PWA and API call

**URL:** <https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462>\
**Category:** Developing with Prismic\
**Tags:** rest-api\
**Created:** [October 28, 2020, 1:29pm UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462 "2020-10-28T13:29:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![brosseau.kevin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/brosseau.kevin/32/1104_2.png) [@brosseau.kevin](https://community.prismic.io/u/brosseau.kevin)\
**Post date:** [October 28, 2020, 1:29pm UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/1 "2020-10-28T13:29:50Z")

</div>

Hi,

I clone the repo of this tuto : [How To Create a Blazing Fast Modern Blog With Nuxt and Prismic | by Trevor-Indrek Lasn | Better Programming](https://medium.com/better-programming/create-a-blazing-fast-modern-blog-with-nuxt-and-prismic-7d19935d849c)  
In order to create a Nuxt.js PWA calling the API of my blog.

I change the API endpoint in the prismic.config file. But i have this error :

Cannot read property 'data' of undefined 14:23:12

at asyncData (pages/index.js:38:97)  
at processTicksAndRejections (internal/process/task\_queues.js:93:5)

I tried to find the solution, but i block... Do you have an idea?

Thanks a lot!  
Kevin

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [October 28, 2020, 5:02pm UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/2 "2020-10-28T17:02:04Z")

</div>

Hey Kevin,

This article is really out of date,

You should check out building an app with Nuxt, Prismic and Slicemachine 🙂

> **[Slice Machine](https://www.slicemachine.dev/documentation/nuxt/)**
>
> Devs make the parts, users make the websites.

OR one of our sample projects than don't yet use Slicemachine:

> **[Nuxt.js Sample multi-page website with navigation](https://user-guides.prismic.io/en/articles/2831943-nuxt-js-sample-multi-page-website-with-navigation)**
>
> Want to statically deploy website with Prismic? Worried about the SEO issues that come with Vue.js? Nuxt.js & Prismic to the rescue.

Thanks.

---

<div class="post-metadata">

**Author:** ![brosseau.kevin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/brosseau.kevin/32/1104_2.png) [@brosseau.kevin](https://community.prismic.io/u/brosseau.kevin)\
**Post date:** [October 28, 2020, 10:25pm UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/4 "2020-10-28T22:25:22Z")

</div>

Hello,

Thank you for your answer, i tried the Slice Machine tuto, but it doesn't work. The repo is not created. I have this error.

ERROR Unexpected status code [404] on URL [https://warenghem2.cdn.prismic.io/api/v2?routes=[{"type"%3A"page"%2C"path"%3A"%2F%3Auid"}]](https://warenghem2.cdn.prismic.io/api/v2?routes=%5B%7B%22type%22%3A%22page%22%2C%22path%22%3A%22%2F%3Auid%22%7D%5D)

at node\_modules/prismic-javascript/cjs/prismic-javascript.js:1093:25  
at processTicksAndRejections (internal/process/task\_queues.js:93:5)

ERROR Failed to init Prismic API, preventing app fatal error. 23:23:42

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [October 29, 2020, 9:57am UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/5 "2020-10-29T09:57:55Z")

</div>

Can you tell me which version of the CLI that you're using?  
You can see this by typing `prismic --version` in your terminal

Then can you try to npm install the latest beta version of the CLI if you don't have it yet?

`npm install -g prismic-cli@3.8.3-beta.0`

Once it's done you should type `prismic logout` then `prismic login`

Thanks.

---

<div class="post-metadata">

**Author:** ![brosseau.kevin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/brosseau.kevin/32/1104_2.png) [@brosseau.kevin](https://community.prismic.io/u/brosseau.kevin)\
**Post date:** [October 29, 2020, 11:09am UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/6 "2020-10-29T11:09:04Z")

</div>

Hi,

That part is working. Repo is created. But there is an issue with the \_uid.vue file created, i have this error after npm run dev (i copy/past the code in [https://www.slicemachine.dev/documentation/nuxt/quick-start/](https://www.slicemachine.dev/documentation/nuxt/quick-start/))

Thanks 🙂

ERROR in ./pages/\_uid.vue  
Module Error (from ./node\_modules/eslint-loader/dist/cjs.js):

/Users/kevin/nuxtjsblog/my-slicemachine-project/pages/\_uid.vue  
2:3 error Replace `··<slice-zone⏎········type="page"⏎········:uid="$route.params.uid"⏎···` with `<slice-zone·type="page"·:uid="$route.params.uid"` prettier/prettier  
12:3 error Delete `··` prettier/prettier  
13:1 error Replace `········SliceZone` with `····SliceZone,` prettier/prettier  
14:1 error Delete `··` prettier/prettier  
16:10 error Insert `⏎` prettier/prettier

✖ 5 problems (5 errors, 0 warnings)  
5 errors and 0 warnings potentially fixable with the `--fix` option.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [October 29, 2020, 3:26pm UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/7 "2020-10-29T15:26:48Z")

</div>

Ooo, seems like a linter issue. If you can disable your linter it will confirm this?

---

<div class="post-metadata">

**Author:** ![brosseau.kevin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/brosseau.kevin/32/1104_2.png) [@brosseau.kevin](https://community.prismic.io/u/brosseau.kevin)\
**Post date:** [October 30, 2020, 8:30pm UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/8 "2020-10-30T20:30:05Z")

</div>

Thanks; But how to disable eslint from your project?

---

<div class="post-metadata">

**Author:** ![brosseau.kevin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/brosseau.kevin/32/1104_2.png) [@brosseau.kevin](https://community.prismic.io/u/brosseau.kevin)\
**Post date:** [October 30, 2020, 8:55pm UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/9 "2020-10-30T20:55:47Z")

</div>

Sorry 🙂  
I disable it from nuxt project. But i have the Nuxt.js hello/classic page only. Not the page that says that my slice zone is empty...

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [November 4, 2020, 10:00am UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/10 "2020-11-04T10:00:18Z")

</div>

Hey Kevin,

Sorry I was unavailable for a few days.

Did you add the new dynamic page as described here?

> **[Slice Machine](https://www.slicemachine.dev/documentation/nuxt/add-the-slice-zone-to-your-page/)**
>
> Devs make the parts, users make the websites.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [November 18, 2020, 11:02am UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/11 "2020-11-18T11:02:54Z")

</div>

This issue has been closed due to inactivity. [Flag to reopen](https://community.prismic.io/t/re-open-a-thread/2175).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 5:05pm UTC](https://community.prismic.io/t/nuxt-js-pwa-and-api-call/2462/12 "2021-12-09T17:05:38Z")

</div>


