furyscript

furyscript posted a new bug report

nuxt.js • 7 hours ago

bug Redirect into fecth/asyncData not work 100% with vuex-persistedstate

Version

v1.4.0

Reproduction link

https://github.com/furyscript/nuxt-redirect-error

Steps to reproduce

You need to login, go to inspire page and make sure the first http call is a 200 request. After that try to refresh page (F5 into /inspire) until the http call return a 401 error, so you see that you return to home and not in login page.

What is expected ?

It's expected to go into login page without flickering and back to the page.

What is actually happening?

I already opened an issue to vuex-persistedstate but he says that is a problem of nuxt.
Related: https://github.com/robinvdvleuten/vuex-persistedstate/issues/143

jhpmatos

jhpmatos posted a new question

nuxt-generate-cluster • 8 hours ago

Task stops if callback is passed

When passing a callback to routes(callback, params). It works with only params: routes(params)

alphaelf

alphaelf posted a new question

create-nuxt-app • 9 hours ago

disable CSRF for SPA

i use adonis for server side api and for SPA, CSRF must be disable, so is this better disabled by default?

iamsayantan

iamsayantan posted a new question

auth-module • 10 hours ago

How to programitically set redirect path?

If we try to access a page which requires authentication then we are redirected to login page and upon login we are redirected to the page we originally wanted to access. I would like to set this redirect path manually. I want to redirect to login page on click of a button if not authenticated and upon login would like to redirect back to the previous page. Is there a way to set redirect path before redirecting user to login page on button click?

japboy

japboy posted a new question

nuxt.js • 11 hours ago

A way to expose JavaScript objects created on server-side?

Well this is basically same question I wrote here: https://cmty.app/nuxt/modules/issues/c129

I am working on transition to Nuxt from a website based on server-side templates. There are many datas created on server-side and I have to access them through client-side JavaScript.

Let's say there is a server-side template like this;

<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ ... });
<script>

In this case, it is critical to put the data before Google Tag Manager is initialized, so dataLayer is generated on server-side templates.

I need to do the same thing with Nuxt.js. Like, creating dataLayer object on server-side and access it from client-side.

I couldn't find a way to archive this. Any advices are appreciated.

Thanks.

ximolang

ximolang posted a new question

express-template • 12 hours ago

Which folder should be uploaded to the picture?

Unfortunately, When I handled the function of uploading the picture, I found a problem here, I don't know which folder should be uploaded, because I had uploaded picture in a folder, but can't access it with URL.
I've tried the static folder, still cannot be accessed.
I hope to help me, thanks very much!

mlyticsAdamGe

mlyticsAdamGe posted a new question

nuxt.js • 14 hours ago

Require is not a function

I'm using nuxt v1.4.1.

I run npm run dev always fine.

When I build my project there few warning about entry point size ,but still not error.

and then I run nuxt start ,the server instance is run perfect.

But I open the browser to browse my page ,there are few 'require is not a function'
screenshot2018-06-19 下午12.00.27.png

japboy

japboy posted a new question

modules • 15 hours ago

Does google-tag-manager module provide a way to push DataLayer on server side?

My website currently working on transition to Nuxt heavily depends on GTM DataLayer which is set on server side.

Previous implementation of server side templates is like;

<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push(...);
window.dataLayer.push(...);
window.dataLayer.push(...);
</script>

so I have to prepare the dataLayer object before gtm.js is initialized. Does this module provide a way to do so?

Thanks.

JFstandart

JFstandart posted a new question

docs • 21 hours ago

Translate to Spanish

Translate to Spanish

Hi, I want to help translate the documents into Spanish,
Any recommendations or advice that you want to give me?

LookinGit

LookinGit posted a new feature request

nuxt.js • a day ago

idea Need add watchQuery merge strategy for mixins

What problem does this feature solve?

Property watchQuery of page overrides watchQuery from mixins, but i want to do merging watchQuery

What does the proposed changes look like?

import union from 'lodash/union';

Vue.config.optionMergeStrategies.watchQuery = function (toVal, fromVal) {
  return union(toVal, fromVal);
};
raynox

raynox posted a new question

nuxt-i18n • a day ago

SyntaxError: Unexpected token export

Hi, I tried your example with i18n - https://nuxtjs.org/examples/i18n/ and i got this error:

(function (exports, require, module, __filename, __dirname) { export default {
^^^^^^

SyntaxError: Unexpected token export
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module.compile (internal/modules/cjs/loader.js:670:28) at Object.Module.extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module.load (internal/modules/cjs/loader.js:543:3) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at exports.loadNuxtConfig.argv (/Users/jakubsaleniuk/PhpstormProjects/i18n/nodemodules/nuxt/bin/common/utils.js:18:15)
at Object.<anonymous> (/Users/jakubsaleniuk/PhpstormProjects/i18n/nodemodules/nuxt/bin/nuxt-dev:63:20) at Module.compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)

How can i fix this?

brandonaaskov

brandonaaskov posted a new question

docs • a day ago

Change "Starting From Scratch" to specify Vue CLI version?

The "Starting From Scratch" section in the installation guide (https://nuxtjs.org/guide/installation) assumes you've created a vue project with the [email protected]

Projects created with the new Vue CLI (@3.0.0-rc.2), with nuxt added on top, fail to build. The issue is that the new CLI uses Babel 7 plugins, and nuxt expects the Babel 6 variety of babel-plugin-transform-runtime.

Adding some kind of versioning language in the docs will help alleviate confusion for people setting up new projects.

Atinux

Atinux resolved the question #c502

nuxt.js • a day ago

JWT authentication with Nuxt.js

Hi @pkucmus

Please take a deep look at https://github.com/nuxt/example-auth0, we store the token in the cookie to be able to fetch it on the server-side.

sobolevn

sobolevn posted a new question

nuxt.js • a day ago

How to test Nuxt middlewares with vue-test-utils?

Hi, I have starving to find any information about testing middleware?

That's what component looks like:

import Vue from 'vue'
import Component from 'nuxt-class-component'
import { State } from 'vue-property-decorator'

// @vue/component
@Component({
  middleware: 'auth' // it comes from `auth-module`
})
export default class Index extends Vue {
  @State('user')  user
}

When trying to test this component with @vue/test-utils - I can not make middleware to work.
So, it is completely ignored. This is expected, since middleware is not native vue property, but I still want to tests it somehow.

Here's the test setup I am using: https://github.com/wemake-services/wemake-vue-template/blob/master/template/tests/views/index.spec.js

What are the recommended solutions? Or some hacks maybe?
Thanks!

Geminii

Geminii posted a new question

auth-module • a day ago

Redirect not working after login/logout

Version
v4.5.1

Reproduction link
https://github.com/nuxt-community/auth-module

Configuration

auth: {
    // Options
    strategies: {
      local: {
        endpoints: {
          login: { url: process.env.BASE_URL + '/auth', method: 'post', propertyName: 'token' },
          logout: false,
          user: { url: process.env.BASE_URL + '/users/auth', method: 'get', propertyName: false }
        }
      }
    },
    redirect: {
      login: '/signin',
      logout: '/signin',
      home: '/home'
    },
    watchLoggedIn: true,
    rewriteRedirects: false,
    resetOnError: true
  }

Action to login :

this.$auth.loginWith('local', {
            data: {
              username: this.username,
              password: this.password
            }
});

Action to logout :
await this.$auth.logout();

Steps to reproduce
I use local strategy with a token. After the token expires if i reload the page, the user is logged out because i have resetOnError=True. I'm redirect to my signin page. Then i try to reconnect, i get new token and when i check into VueX, i got this result :

auth: {
     busy:false,
     loggedIn:true,
     strategy:"local",
     user: { ... }
 }

But i'm not redirect to home page … If i refresh, i'm connected into the home page.

Where i'm doing wrong ?
Thanks for your answers.

Regards,

Geminii

Geminii posted a new question

auth-module • a day ago

Redirect not working after login or logout

Version
v4.5.1

Reproduction link
https://github.com/nuxt-community/auth-module

Configuration
auth: { // Options strategies: { local: { endpoints: { login: { url: process.env.BASE_URL + '/auth', method: 'post', propertyName: 'token' }, logout: false, user: { url: process.env.BASE_URL + '/users/auth', method: 'get', propertyName: false } } } }, redirect: { login: '/signin', logout: '/signin', home: '/home' }, watchLoggedIn: true, rewriteRedirects: false, resetOnError: true }

Action to login :
this.$auth.loginWith('local', { data: { username: this.username, password: this.password } });

Action to logout :
await this.$auth.logout();

Steps to reproduce
I use local strategy with a token. After the token expires if i reload the page, the user is logged out because i have resetOnError=True. I'm redirect to my signin page. Then i try to reconnect, i get new token and when i check into VueX, i got this result :

auth: {
busy:false,
loggedIn:true,
strategy:"local",
user: { ... }
 }

But i'm not redirect to home page … If i refresh, i'm connected into the home page.

Where i'm doing wrong ?
Thanks for your answers.

Regards,

methodbox

methodbox posted a new question

docs • 2 days ago

API Docs Don’t Render on iOS Correctly
  1. Don’t use GitHub if you want me to open issues somewhere else; I’m not signing up for yet another app and it isn’t explicitly stated to do so on your site.

  2. Your API docs have an issue here: https://nuxtjs.org/api

On iOS they render a single item from the API docs with an ellipses button in the upper right.

“Expanding” this button will show the rest of the docs.

I’m sorry if you “close this issue immediately” instead of fixing your site, but you’ve been informed.

AndrewBogdanovTSS

AndrewBogdanovTSS posted a new question

starter-template • 2 days ago

Integration with Vue CLI 3

Hi! Since Vue CLI 3 is almost out, are there any plans on integrating Nuxt as part of vue create system? Or maybe there is already some kind of workflow we can use?

chenfangyi931

chenfangyi931 posted a new question

hare • 2 days ago

@nuxt/axios If you use the axios built-in CancelToken to cancel the request?

How to make a file upload cancellation using @nuxt/axios

kim366

kim366 posted a new question

nuxt.js • 2 days ago

How do I force mounted() code to be executed on the server?

I have a Nuxt app and a component that has code inside its mounted() hook. This code is only executed on the client, though, as none of the DOM manipulation can be seen in the page source and thus a major delay is caused. How can I force it to execute on the server? Do I need a different function?

Latest Releases see all

Bugfix getAuth function ignored if set (v4.0.0-beta.3)

Released 9 hours ago

Add authenticationType to apollo options (v4.0.0-beta.2)

Released 7 days ago

Bugfix client-server hydration (v4.0.0-beta.1)

Released 12 days ago
Stats
49 repos
8786 commits
4863 issues
225 releases
4662 contributors