Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Wont start, useless #6969

Closed
2 tasks done
R0N1n-dev opened this issue Oct 20, 2023 · 1 comment
Closed
2 tasks done

App Wont start, useless #6969

R0N1n-dev opened this issue Oct 20, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@R0N1n-dev
Copy link

R0N1n-dev commented Oct 20, 2023

👟 Reproduction steps

  1. start vite project with vue
  2. add appwrite according to docs
  3. add appwrite to pinia store
  4. Attempt to start dev server

👍 Expected behavior

Dev server started successfully and page rendering

👎 Actual Behavior

This error:
Screenshot from 2023-10-20 19-24-51

🎲 Appwrite version

Appwrite Cloud

💻 Operating system

Linux

🧱 Your Environment

"appwrite": "^13.0.0"
Javascript Vue

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

import { Client, Databases, Account } from 'appwrite'

const client = new Client()
client.setEndpoint('https://cloud.appwrite.io/v1').setProject('64d4deb82c0b4d951e39') // Replace with your project ID

export const account = new Account(client)
export const databases = new Databases(client)

userStore

import { defineStore } from 'pinia'
import { ID } from 'appwrite'
import { account } from '../appwrite'
import { useRouter } from 'vue-router'
const router = useRouter()
export const useUserStore = defineStore('user', {
  state: () => ({
    user: null,
    loadingSession: false
  }),
  actions: {
    async init() {
      try {
        this.user = await account.get()
      } catch (e) {
        this.user = null
      }
    },
    async register(email, password) {
      try {
        this.loadingSession = true
        await account.create(ID.unique(), email, password)
        await this.login(email, password)
        this.loadingSession = false
      } catch (error) {
        console.log(error.message)
        this.loadingSession = false
      }
    },
    async login(email, password) {
      try {
        this.loadingSession = true
        await account.createEmailSession(email, password)
        this.loadingSession = false
        router.push('/') // Redirect to home page
      } catch (error) {
        this.loadingSession = false
        console.log(error.message) // Redirect
      }
    },
    async logout() {
      try {
        this.loadingSession = true
        await account.deleteSession('user')
        this.loadingSession = false
      } catch (error) {
        this.loadingSession = false
        console.log(error.message)
      }

      this.user = null
      router.push('/login')
    }
  }
})
@R0N1n-dev R0N1n-dev added the bug Something isn't working label Oct 20, 2023
@R0N1n-dev
Copy link
Author

Never mind.Syntax issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant