Skip to content

Commit

Permalink
fix: runtimeConfig init
Browse files Browse the repository at this point in the history
  • Loading branch information
LorexIQ committed Nov 20, 2023
1 parent 9a739b6 commit 258d6ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export default defineNuxtConfig({
ssr: false,
modules: ['../src/module'],
//modules: ['../src/module'],
modules: ['../dist/module'],

localAuth: {
origin: 'https://catman-dev.atrinix.ru/api/v1/',
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/composables/useLocalAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class LocalAuthError extends Error {
}

async function getContext() {
const options = useRuntimeConfig().public.localAuth as ModuleOptions;
const nuxt = useNuxtApp();
const options = (await callWithNuxt(nuxt, useRuntimeConfig)).public.localAuth as ModuleOptions;
const state = await callWithNuxt(nuxt, useLocalAuthState);

return {
Expand Down Expand Up @@ -101,6 +101,7 @@ async function getMe<T>(): Promise<T> {
throw new LocalAuthError(`getMe > [${e.statusCode}] > ${JSON.stringify(e.response._data)}`);
}
}
// async function refreshToken()

export function useLocalAuth() {
const { data, meta, token } = useLocalAuthState()
Expand Down

0 comments on commit 258d6ec

Please sign in to comment.