WafelT
@WafelT
HTML/CSS/JavaScript

Как из store зарефетчить все запросы из fetch() на текущей странице?

async fetch() {
        await this.$store.dispatch('contract/fetchTheTemplate', { id: this.$route.params.id })
    }

Как обновить все fetch запросы на текущей странице (из action в store)?

Это action:

refresh: async function ({ commit }) {
            try {
                const res = await this.$axios({
                    method: 'post',
                    url: `/accounts/api/auth/jwt/refresh/`,
                    data: { refresh: this.$cookies.get('refresh') }
                })
                this.$cookies.set('token', res.data.access)
                this.$axios.setHeader('Authorization', `Bearer ${res.data.access}`)
                ... Код для обновления всех fetch()
            } catch (error) {
                console.dir(error)
            }
        },
  • Вопрос задан
  • 102 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы