forked from mirrors/homebox
461be2afca
* initial UI for currency selection * add task to purge invitation tokens * group API contracts * fix type import * use auth middleware * add currency setting support (UI) * use group settings for format currency * fix casing
15 lines
327 B
TypeScript
15 lines
327 B
TypeScript
import { useAuthStore } from "~~/stores/auth";
|
|
|
|
export default defineNuxtRouteMiddleware(async () => {
|
|
const auth = useAuthStore();
|
|
const api = useUserApi();
|
|
|
|
if (!auth.self) {
|
|
const { data, error } = await api.user.self();
|
|
if (error) {
|
|
navigateTo("/");
|
|
}
|
|
|
|
auth.$patch({ self: data.item });
|
|
}
|
|
});
|