generated from VLADIMIR/template_frontend
clear
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
@@ -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[]>([])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user