-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
@aslan.gama.solluti
committed
Dec 14, 2023
1 parent
9f04aa0
commit 9ddd958
Showing
8 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default defineEventHandler((event) => { | ||
const hello = 'Hello' | ||
|
||
return {hello} | ||
}) |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default defineNuxtRouteMiddleware((to, from) => { | ||
//console.log(to) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default defineNuxtRouteMiddleware((to, from) => { | ||
//console.log(to) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { | ||
useLogger, | ||
createResolver, | ||
defineNuxtModule, | ||
addServerHandler, | ||
addPlugin, | ||
addRouteMiddleware | ||
} from '@nuxt/kit' | ||
|
||
const PACKAGE_NAME = 'nuxt-simple-auth' | ||
export default defineNuxtModule({ | ||
|
||
meta: { | ||
name: PACKAGE_NAME, | ||
configKey: 'auth' | ||
}, | ||
async setup(options, nuxt) { | ||
const logger = useLogger(PACKAGE_NAME) | ||
|
||
|
||
const {resolve} = createResolver(import.meta.url) | ||
console.log(nuxt.options.auth) | ||
|
||
if (nuxt.options.auth.strategies['2fa'].active) { | ||
addRouteMiddleware({ | ||
name: '_2fa', | ||
path: resolve('./core/2fa.js'), | ||
}) | ||
} | ||
|
||
addRouteMiddleware({ | ||
name: 'auth', | ||
path: resolve('./core/auth.js'), | ||
}) | ||
|
||
// Add plugin template | ||
addPlugin({ | ||
src: resolve('plugin.js'), | ||
mode: 'all', | ||
options: nuxt.options.auth | ||
}) | ||
|
||
|
||
// Add server-plugin | ||
addServerHandler( | ||
{ | ||
route: '/api/auth', | ||
handler: resolve('./api/auth.js') | ||
}, | ||
{ | ||
route: '/api/logout', | ||
handler: resolve('./api/logout.js') | ||
}, | ||
{ | ||
route: '/api/profile', | ||
handler: resolve('./api/profile.js') | ||
} | ||
) | ||
|
||
// logger.success('`nuxt-simple-auth` setup done') | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default defineNuxtPlugin((nuxtApp) => { | ||
|
||
//console.log(nuxtApp) | ||
|
||
// const {data: response, pending, error, refresh} = await useFetch('/api/cookies'); | ||
// | ||
// | ||
// console.log(response) | ||
|
||
//const {data: response, pending, error, refresh} = await useFetch('/api/authentication') | ||
|
||
//console.log(response) | ||
|
||
}) |