Ошибка унавторайзед, если в режиме инкогнито (без кук)
|
|
@ -108,12 +108,32 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, computed } from 'vue';
|
||||
import { ref, reactive, watch, computed, onMounted } from 'vue';
|
||||
|
||||
// --- Composables ---
|
||||
const api = useApi();
|
||||
const { user, updateUser, register } = useAuth();
|
||||
|
||||
// --- Onboardning initiation ---
|
||||
onMounted(async () => {
|
||||
if (user.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
isLoading.value = true;
|
||||
const anonymousUser = await api('/api/onboarding/initiate', { method: 'POST' });
|
||||
if (anonymousUser) {
|
||||
updateUser(anonymousUser);
|
||||
}
|
||||
} catch (e: any) {
|
||||
error.value = 'Не удалось начать сессию. Попробуйте обновить страницу';
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// --- Economy Constants ---
|
||||
const { data: economy, pending: economyPending } = useAsyncData('economy-constants', () =>
|
||||
$fetch('/api/economy/constants')
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 161 KiB |
|
Before Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 140 KiB |