Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
some-user123 authored Sep 7, 2023
0 parents commit 92ab80a
Show file tree
Hide file tree
Showing 12 changed files with 5,359 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Nuxt 3 Minimal Starter

Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Setup

Make sure to install the dependencies:

```bash
# yarn
yarn install

# npm
npm install

# pnpm
pnpm install
```

## Development Server

Start the development server on http://localhost:3000

```bash
npm run dev
```

## Production

Build the application for production:

```bash
npm run build
```

Locally preview production build:

```bash
npm run preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
5 changes: 5 additions & 0 deletions app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<NuxtPage />
</div>
</template>
10 changes: 10 additions & 0 deletions composables/myFetch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export async function myFetch(url: string) {
try {
return await $fetch('http://url.that.will.respond.with.error.com');
} catch (e) {
// differentiate error and in case it is a 401/403:
console.log('redirecting...');
await navigateTo('/login?ret=%2F');
throw new Error('unauthenticated');
}
}
11 changes: 11 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
ssr: false,

modules: ['@nuxtjs/i18n'],

i18n: {
defaultLocale: 'en',
strategy: 'no_prefix',
},
});
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"devDependencies": {
"@nuxtjs/i18n": "^8.0.0-rc.4",
"nuxt": "^3.7.1"
}
}
7 changes: 7 additions & 0 deletions pages/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template><div>Should redirect</div></template>

<script setup>
await useAsyncData(async () => {
return myFetch('foo');
});
</script>
12 changes: 12 additions & 0 deletions pages/login.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
Login
<button @click="nav">Button</button>
</template>

<script setup lang="ts">
const nav = async () => {
console.log('navigating to page2');
const ret = await navigateTo({ path: '/page2', query: { q: 'foo' } });
console.log('done', ret);
};
</script>
1 change: 1 addition & 0 deletions pages/page2.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<template>Page2 <a href="/">Home</a></template>
Loading

0 comments on commit 92ab80a

Please sign in to comment.