-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from manchenkoff/95-feature-support-custom-hea…
…ders-for-usesanctumclient-instance feat: support custom headers for sanctum client instance
- Loading branch information
Showing
18 changed files
with
3,980 additions
and
2,132 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 |
---|---|---|
|
@@ -23,17 +23,17 @@ | |
"dist" | ||
], | ||
"scripts": { | ||
"prepack": "nuxt-module-build", | ||
"prepack": "nuxt-module-build build", | ||
"dev": "nuxi dev playground", | ||
"dev:build": "nuxi build playground", | ||
"dev:prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare playground", | ||
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground", | ||
"lint": "eslint .", | ||
"fmt": "prettier --write .", | ||
"fmt:check": "prettier --check .", | ||
"types": "nuxi typecheck", | ||
"test": "vitest run", | ||
"test:watch": "vitest watch", | ||
"validate": "npm run fmt:check && npm run lint && npm run types && npm run test", | ||
"test:types": "nuxi typecheck", | ||
"validate": "npm run fmt:check && npm run lint && npm run test:types && npm run test", | ||
"release": "npm run validate && npm run prepack && changelogen --release && npm publish && git push" | ||
}, | ||
"dependencies": { | ||
|
@@ -42,8 +42,8 @@ | |
}, | ||
"devDependencies": { | ||
"@nuxt/devtools": "latest", | ||
"@nuxt/eslint-config": "^0.2.0", | ||
"@nuxt/module-builder": "^0.5.5", | ||
"@nuxt/eslint-config": "^0.3.13", | ||
"@nuxt/module-builder": "^0.7.0", | ||
"@nuxt/schema": "^3.9.0", | ||
"@nuxt/test-utils": "^3.9.0", | ||
"@types/node": "^20.11.13", | ||
|
@@ -52,15 +52,16 @@ | |
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"h3": "^1.10.1", | ||
"nitropack": "^2.9.6", | ||
"nuxi": "^3.10.0", | ||
"nuxt": "^3.10.0", | ||
"nuxt": "^3.11.2", | ||
"prettier": "^3.0.3", | ||
"typescript": "^5.2.2", | ||
"typescript": "^5.4.5", | ||
"vite": "^4.4.9", | ||
"vitest": "^1.2.2", | ||
"vue": "^3.3.4", | ||
"vue-router": "^4.2.5", | ||
"vue-tsc": "^1.8.26" | ||
"vue-tsc": "^2.0.19" | ||
}, | ||
"packageManager": "[email protected]" | ||
} | ||
} |
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,26 @@ | ||
import type { FetchContext } from 'ofetch'; | ||
import type { ConsolaInstance } from 'consola'; | ||
import type { NuxtApp } from '#app'; | ||
import { defineAppConfig } from '#imports'; | ||
|
||
export default defineAppConfig({ | ||
sanctum: { | ||
interceptors: { | ||
onRequest: async ( | ||
app: NuxtApp, | ||
ctx: FetchContext, | ||
logger: ConsolaInstance | ||
) => { | ||
logger.debug(`custom onRequest interceptor (${ctx.request})`); | ||
}, | ||
|
||
onResponse: async ( | ||
app: NuxtApp, | ||
ctx: FetchContext, | ||
logger: ConsolaInstance | ||
) => { | ||
logger.debug(`custom onResponse interceptor (${ctx.request})`); | ||
}, | ||
}, | ||
}, | ||
}); |
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"extends": "../.nuxt/tsconfig.server.json", | ||
"extends": "../.nuxt/tsconfig.server.json" | ||
} |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{ | ||
"extends": "./.nuxt/tsconfig.json", | ||
"exclude": ["../dist"], | ||
"extends": "./.nuxt/tsconfig.json" | ||
} |
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,31 @@ | ||
import type { SanctumModuleOptions } from './runtime/types'; | ||
|
||
export const defaultModuleOptions: Partial<SanctumModuleOptions> = { | ||
userStateKey: 'sanctum.user.identity', | ||
redirectIfAuthenticated: false, | ||
endpoints: { | ||
csrf: '/sanctum/csrf-cookie', | ||
login: '/login', | ||
logout: '/logout', | ||
user: '/api/user', | ||
}, | ||
csrf: { | ||
cookie: 'XSRF-TOKEN', | ||
header: 'X-XSRF-TOKEN', | ||
}, | ||
client: { | ||
retry: false, | ||
}, | ||
redirect: { | ||
keepRequestedRoute: false, | ||
onLogin: '/', | ||
onLogout: '/', | ||
onAuthOnly: '/login', | ||
onGuestOnly: '/', | ||
}, | ||
globalMiddleware: { | ||
enabled: false, | ||
allow404WithoutAuth: true, | ||
}, | ||
logLevel: 3, | ||
}; |
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
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,6 @@ | ||
import { useAppConfig } from '#app'; | ||
import type { SanctumAppConfig } from '../types'; | ||
|
||
export const useSanctumAppConfig = (): SanctumAppConfig => { | ||
return (useAppConfig().sanctum ?? {}) as SanctumAppConfig; | ||
}; |
Oops, something went wrong.