This commit is contained in:
2026-07-18 23:48:35 +07:00
parent 28f1e43338
commit b81000249b
2 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -1,8 +1,13 @@
import { useAuthStore } from "@/stores/auth";
import { createEveningDetectiveServerClient, type EveningDetectiveServer } from "./generated/crabs/evening_detective_server"; import { createEveningDetectiveServerClient, type EveningDetectiveServer } from "./generated/crabs/evening_detective_server";
import { createHttpHandler } from "./generated/crabs/evening_detective_server/client"; import { createHttpHandler } from "./generated/crabs/evening_detective_server/client";
export function getAuthClient() {
const authStore = useAuthStore();
return buildAuthClient(authStore.refreshTokenAction, authStore.getToken)
}
export function buildAuthClient( function buildAuthClient(
refreshTokens: () => Promise<boolean>, refreshTokens: () => Promise<boolean>,
getToken: () => string | null, getToken: () => string | null,
): EveningDetectiveServer { ): EveningDetectiveServer {
+2 -2
View File
@@ -17,14 +17,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { buildAuthClient } from '@/api/auth_client'; import { getAuthClient } from '@/api/auth_client';
import router from '@/router'; import router from '@/router';
import { useAuthStore } from '@/stores/auth'; import { useAuthStore } from '@/stores/auth';
import { ref } from 'vue'; import { ref } from 'vue';
const authStore = useAuthStore(); const authStore = useAuthStore();
const client = buildAuthClient(authStore.refreshTokenAction, authStore.getToken) const client = getAuthClient()
const permissions = ref<string[]>([]) const permissions = ref<string[]>([])