Next.js Discord

Discord Forum
\n\nthis config // https://nuxt.com/docs/api/configuration/nuxt-config\nexport default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: false},\n\n devServer :{\n host: 'api.test'\n },\n\n modules: [\"nuxt-auth-sanctum\",\"@nuxtjs/apollo\"],\n\n apollo: {\n clients: {\n default: {\n httpLinkOptions: {\n credentials:'inculde'\n },\n\n httpEndpoint: 'http://api.test/graphiql'\n }\n },\n },\n\n sanctum:{\n baseUrl: 'http://api.test',\n\n redirect: {\n onLogin: '/dashboard',\n onAuthOnly: '/auth/login',\n onGuestOnly: '/dashboard'\n \n }\n\n },\n\n css: ['~/assets/css/app.css'],\n\n postcss: {\n plugins: {\n tailwindcss: {},\n autoprefixer: {},\n },\n },\n})","dateCreated":"2024-08-15T12:18:34.335Z","answerCount":0,"author":{"@type":"Person","name":"khulood Batis"}}}

Apoll config not work

Unanswered
khulood Batis posted this in #help-forum
Open in Discord
my question how set configration apoll in nuxt3 to use graphql that i work laravel 11 api and nuxt 3 frontend
this index page
<script lang="ts" setup>


const query = gql`
         {   jobs(
                orderBy: [{column:CREATED_AT ,order:DESC}],
                        ){
                id,
                job_title,
                }
            }
        `
 const variables = { limit: 5 }
const { data } = await useAsyncQuery(query, variables)
</script>

<template>
    <div>
       <div class="text-center py-10 text-red-500">
        <h1 class="text-4xl font-bold mb-2">Find the best jobs in the world.</h1>
           <p class="text-gray-600 font-medium">
              we're the best job board in the enrire world.
           </p>
       </div>
  
       <div class="mt-10">
          jobs index
       </div>
  
  
    </div>
    </template>

this config

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-04-03',
  devtools: { enabled: false},

  devServer :{
    host: 'api.test'
  },

  modules: ["nuxt-auth-sanctum","@nuxtjs/apollo"],

  apollo: {
    clients: {
      default: {
        httpLinkOptions: {
          credentials:'inculde'
        },

        httpEndpoint: 'http://api.test/graphiql'
      }
    },
  },

  sanctum:{
    baseUrl: 'http://api.test',

    redirect: {
      onLogin: '/dashboard',
      onAuthOnly: '/auth/login',
      onGuestOnly: '/dashboard'
      
    }

  },

  css: ['~/assets/css/app.css'],

  postcss: {
    plugins: {
      tailwindcss: {},
      autoprefixer: {},
    },
  },
})

0 Replies