Skip to content

Commit

Permalink
upd: main store avatar logic
Browse files Browse the repository at this point in the history
  • Loading branch information
vikdiesel committed Sep 28, 2023
1 parent 5231122 commit c119406
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/stores/main.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { ref, computed } from 'vue'
import axios from 'axios'

export const useMainStore = defineStore('main', () => {
const userName = ref('john doe')
const userEmail = ref('john@example.com')
const userAvatar = ref('https://avatars.dicebear.com/api/avataaars/example.svg')
const userName = ref('John Doe')
const userEmail = ref('doe.doe.doe@example.com')

// ... or you can use computed:
// const userAvatar = computed(
// () =>
// `https://avatars.dicebear.com/api/avataaars/${userName.value.replace(
// /[^a-z0-9]+/i,
// ''
// )}.svg`
// )
const userAvatar = computed(
() =>
`https://avatars.dicebear.com/api/avataaars/${userEmail.value.replace(
/[^a-z0-9]+/gi,
'-'
)}.svg`
)

const isFieldFocusRegistered = ref(false)

Expand All @@ -28,9 +26,6 @@ export const useMainStore = defineStore('main', () => {
if (payload.email) {
userEmail.value = payload.email
}
if (payload.avatar) {
userAvatar.value = payload.avatar
}
}

function fetchSampleClients() {
Expand Down

0 comments on commit c119406

Please sign in to comment.