2
2
mirror of https://github.com/Thream/website.git synced 2024-07-21 09:28:32 +02:00

fix: update dependencies to latest

This commit is contained in:
Divlo 2023-01-11 17:39:09 +01:00
parent b5089f7f0b
commit cd1a477324
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
31 changed files with 1243 additions and 17860 deletions

View File

@ -1,2 +1 @@
ARG VARIANT="18" FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:18
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

View File

@ -1,12 +1,5 @@
.vscode .*
.git !.npmrc
.env
build build
.next
coverage coverage
node_modules node_modules
tmp
temp
.DS_Store
.lighthouseci
.vercel

View File

@ -16,7 +16,7 @@ jobs:
language: ['javascript'] language: ['javascript']
steps: steps:
- uses: 'actions/checkout@v3.1.0' - uses: 'actions/checkout@v3.3.0'
- name: 'Initialize CodeQL' - name: 'Initialize CodeQL'
uses: 'github/codeql-action/init@v2' uses: 'github/codeql-action/init@v2'

View File

@ -10,10 +10,10 @@ jobs:
build: build:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.1.0' - uses: 'actions/checkout@v3.3.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.5.1' uses: 'actions/setup-node@v3.6.0'
with: with:
node-version: '18.x' node-version: '18.x'
cache: 'npm' cache: 'npm'

View File

@ -10,10 +10,10 @@ jobs:
lint: lint:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.1.0' - uses: 'actions/checkout@v3.3.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.5.1' uses: 'actions/setup-node@v3.6.0'
with: with:
node-version: '18.x' node-version: '18.x'
cache: 'npm' cache: 'npm'
@ -30,8 +30,8 @@ jobs:
- name: 'lint:markdown' - name: 'lint:markdown'
run: 'npm run lint:markdown' run: 'npm run lint:markdown'
- name: 'lint:typescript' - name: 'lint:eslint'
run: 'npm run lint:typescript' run: 'npm run lint:eslint'
- name: 'lint:prettier' - name: 'lint:prettier'
run: 'npm run lint:prettier' run: 'npm run lint:prettier'
@ -40,8 +40,3 @@ jobs:
uses: 'dotenv-linter/action-dotenv-linter@v2' uses: 'dotenv-linter/action-dotenv-linter@v2'
with: with:
github_token: ${{ secrets.github_token }} github_token: ${{ secrets.github_token }}
- name: 'lint:docker'
uses: 'hadolint/hadolint-action@v3.0.0'
with:
dockerfile: './Dockerfile'

View File

@ -8,7 +8,7 @@ jobs:
release: release:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.1.0' - uses: 'actions/checkout@v3.3.0'
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false
@ -21,7 +21,7 @@ jobs:
git_commit_gpgsign: true git_commit_gpgsign: true
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.5.1' uses: 'actions/setup-node@v3.6.0'
with: with:
node-version: '18.x' node-version: '18.x'
cache: 'npm' cache: 'npm'

View File

@ -10,10 +10,10 @@ jobs:
test-unit: test-unit:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.1.0' - uses: 'actions/checkout@v3.3.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.5.1' uses: 'actions/setup-node@v3.6.0'
with: with:
node-version: '18.x' node-version: '18.x'
cache: 'npm' cache: 'npm'
@ -27,10 +27,10 @@ jobs:
test-lighthouse: test-lighthouse:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.1.0' - uses: 'actions/checkout@v3.3.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.5.1' uses: 'actions/setup-node@v3.6.0'
with: with:
node-version: '18.x' node-version: '18.x'
cache: 'npm' cache: 'npm'
@ -52,10 +52,10 @@ jobs:
test-e2e: test-e2e:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.1.0' - uses: 'actions/checkout@v3.3.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.5.1' uses: 'actions/setup-node@v3.6.0'
with: with:
node-version: '18.x' node-version: '18.x'
cache: 'npm' cache: 'npm'

View File

@ -1,11 +1,5 @@
{ {
"config": {
"default": true,
"MD013": false,
"MD024": false,
"MD033": false,
"MD041": false
},
"globs": ["**/*.{md,mdx}"], "globs": ["**/*.{md,mdx}"],
"ignores": ["**/node_modules"] "ignores": ["**/node_modules"],
"customRules": ["markdownlint-rule-relative-links"]
} }

7
.markdownlint.json Normal file
View File

@ -0,0 +1,7 @@
{
"default": true,
"relative-links": true,
"extends": "markdownlint/style/prettier",
"MD033": false,
"MD041": false
}

View File

@ -1,21 +1,21 @@
FROM node:18.12.1 AS dependencies FROM node:18.13.0 AS builder-dependencies
WORKDIR /usr/src/app WORKDIR /usr/src/application
COPY ./package*.json ./ COPY ./package*.json ./
RUN npm install RUN npm install
FROM node:18.12.1 AS builder FROM node:18.13.0 AS builder
WORKDIR /usr/src/app WORKDIR /usr/src/application
COPY --from=builder-dependencies /usr/src/application/node_modules ./node_modules
COPY ./ ./ COPY ./ ./
COPY --from=dependencies /usr/src/app/node_modules ./node_modules
RUN npm run build RUN npm run build
FROM node:18.12.1 AS runner FROM gcr.io/distroless/nodejs18-debian11:latest AS runner
WORKDIR /usr/src/app WORKDIR /usr/src/application
ENV NODE_ENV=production ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=builder /usr/src/app/.next/standalone ./ COPY --from=builder /usr/src/application/.next/standalone ./
COPY --from=builder /usr/src/app/.next/static ./.next/static COPY --from=builder /usr/src/application/.next/static ./.next/static
COPY --from=builder /usr/src/app/public ./public COPY --from=builder /usr/src/application/public ./public
COPY --from=builder /usr/src/app/locales ./locales COPY --from=builder /usr/src/application/locales ./locales
COPY --from=builder /usr/src/app/next.config.js ./next.config.js COPY --from=builder /usr/src/application/next.config.js ./next.config.js
CMD ["node", "server.js"] CMD ["./server.js"]

View File

@ -18,7 +18,7 @@
Thream's website to stay close with your friends and communities. Thream's website to stay close with your friends and communities.
It uses [Thream/api](https://github.com/Thream/api) [v1.2.3](https://github.com/Thream/api/releases/tag/v1.2.3). It uses [Thream/api](https://github.com/Thream/api) [v1.2.4](https://github.com/Thream/api/releases/tag/v1.2.4).
## ⚙️ Getting Started ## ⚙️ Getting Started

View File

@ -35,7 +35,11 @@ export const CreateGuild: React.FC = () => {
AxiosResponse<{ guild: GuildComplete }> AxiosResponse<{ guild: GuildComplete }>
>('/guilds', { name: formData.name, description: formData.description }) >('/guilds', { name: formData.name, description: formData.description })
const guildId = data.guild.id const guildId = data.guild.id
const channelId = data.guild.channels[0].id const channel = data.guild.channels[0]
if (channel == null) {
throw new Error('No channel found')
}
const channelId = channel.id
await router.push(`/application/${guildId}/${channelId}`) await router.push(`/application/${guildId}/${channelId}`)
return null return null
} catch (error) { } catch (error) {

View File

@ -82,7 +82,7 @@ export const GuildSettings: React.FC = () => {
) => { ) => {
setFetchState('loading') setFetchState('loading')
const files = event?.target?.files const files = event?.target?.files
if (files != null && files.length === 1) { if (files != null && files.length === 1 && files[0] != null) {
const file = files[0] const file = files[0]
const formData = new FormData() const formData = new FormData()
formData.append('icon', file) formData.append('icon', file)

View File

@ -54,7 +54,7 @@ export const SendMessage: React.FC<SendMessageProps> = (props) => {
event event
) => { ) => {
const files = event?.target?.files const files = event?.target?.files
if (files != null && files.length === 1) { if (files != null && files.length === 1 && files[0] != null) {
const file = files[0] const file = files[0]
const formData = new FormData() const formData = new FormData()
formData.append('file', file) formData.append('file', file)

View File

@ -149,7 +149,7 @@ export const UserSettings: React.FC = () => {
) => { ) => {
setFetchState('loading') setFetchState('loading')
const files = event?.target?.files const files = event?.target?.files
if (files != null && files.length === 1) { if (files != null && files.length === 1 && files[0] != null) {
const file = files[0] const file = files[0]
const formData = new FormData() const formData = new FormData()
formData.append('logo', file) formData.append('logo', file)

View File

@ -16,9 +16,9 @@ export const Loader: React.FC<LoaderProps> = (props) => {
className='relative my-0 mx-auto before:block before:pt-[100%] before:content-none' className='relative my-0 mx-auto before:block before:pt-[100%] before:content-none'
style={{ width: `${width}px`, height: `${height}px` }} style={{ width: `${width}px`, height: `${height}px` }}
> >
<svg className={styles.progressSpinnerSvg} viewBox='25 25 50 50'> <svg className={styles['progressSpinnerSvg']} viewBox='25 25 50 50'>
<circle <circle
className={styles.progressSpinnerCircle} className={styles['progressSpinnerCircle']}
cx='50' cx='50'
cy='50' cy='50'
r='20' r='20'

View File

@ -58,10 +58,10 @@ export const SocialMediaButton: React.FC<SocialMediaButtonProps> = (props) => {
style={{ background: socialMediaColor }} style={{ background: socialMediaColor }}
className={classNames( className={classNames(
className, className,
styles.button, styles['button'],
{ {
[styles.buttonGoogle]: socialMedia === 'Google', [styles['buttonGoogle'] as string]: socialMedia === 'Google',
[styles.buttonMedia]: socialMedia !== 'Google' [styles['buttonMedia'] as string]: socialMedia !== 'Google'
}, },
givenClassName givenClassName
)} )}
@ -88,10 +88,10 @@ export const SocialMediaLink: React.FC<SocialMediaLinkProps> = (props) => {
style={{ background: socialMediaColor }} style={{ background: socialMediaColor }}
className={classNames( className={classNames(
className, className,
styles.button, styles['button'],
{ {
[styles.buttonGoogle]: socialMedia === 'Google', [styles['buttonGoogle'] as string]: socialMedia === 'Google',
[styles.buttonMedia]: socialMedia !== 'Google' [styles['buttonMedia'] as string]: socialMedia !== 'Google'
}, },
givenClassName givenClassName
)} )}

View File

@ -13,7 +13,7 @@ const getErrorTranslationKey = (error: Error): string => {
return 'errors:required' return 'errors:required'
} }
if (error.keyword === 'format') { if (error.keyword === 'format') {
if (error.params.format === 'email') { if (error.params['format'] === 'email') {
return 'errors:invalid-email' return 'errors:invalid-email'
} }
return 'errors:invalid' return 'errors:invalid'
@ -43,7 +43,7 @@ export const useFormTranslation = (): UseFormTranslationResult => {
if (error != null) { if (error != null) {
return t(getErrorTranslationKey(error)).replace( return t(getErrorTranslationKey(error)).replace(
'{expected}', '{expected}',
error?.params?.limit error?.params?.['limit']
) )
} }
return undefined return undefined

View File

@ -57,10 +57,13 @@ export const usePagination = <T extends PaginationItem>(
`${url}?${searchParameters.toString()}` `${url}?${searchParameters.toString()}`
) )
if (!inverse) { if (!inverse) {
const endIndex = newItems.length - 1
const lastItem = newItems[endIndex]
afterId.current = afterId.current =
newItems.length > 0 ? newItems[newItems.length - 1].id : null newItems.length > 0 && lastItem != null ? lastItem.id : null
} else { } else {
afterId.current = newItems.length > 0 ? newItems[0].id : null afterId.current =
newItems.length > 0 && newItems[0] != null ? newItems[0].id : null
} }
setItems((oldItems) => { setItems((oldItems) => {
const updatedItems = inverse const updatedItems = inverse
@ -110,10 +113,13 @@ export const usePagination = <T extends PaginationItem>(
const newItems = getPaginationCache<T>(cacheKey) const newItems = getPaginationCache<T>(cacheKey)
setItems(newItems) setItems(newItems)
if (!inverse) { if (!inverse) {
const endIndex = newItems.length - 1
const lastItem = newItems[endIndex]
afterId.current = afterId.current =
newItems.length > 0 ? newItems[newItems.length - 1].id : null newItems.length > 0 && lastItem != null ? lastItem.id : null
} else { } else {
afterId.current = newItems.length > 0 ? newItems[0].id : null afterId.current =
newItems.length > 0 && newItems[0] != null ? newItems[0].id : null
} }
fetchState.current = 'idle' fetchState.current = 'idle'
} }

View File

@ -12,8 +12,8 @@ export const providersTypebox = providers.map((provider) => {
return Type.Literal(provider) return Type.Literal(provider)
}) })
export type ProviderOAuth = typeof providers[number] export type ProviderOAuth = (typeof providers)[number]
export type AuthenticationStrategy = typeof strategies[number] export type AuthenticationStrategy = (typeof strategies)[number]
export const oauthSchema = { export const oauthSchema = {
id, id,

18874
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
"lint:commit": "commitlint", "lint:commit": "commitlint",
"lint:editorconfig": "editorconfig-checker", "lint:editorconfig": "editorconfig-checker",
"lint:markdown": "markdownlint-cli2", "lint:markdown": "markdownlint-cli2",
"lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"", "lint:eslint": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"", "lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
"lint:staged": "lint-staged", "lint:staged": "lint-staged",
"test:unit": "cypress run --component", "test:unit": "cypress run --component",
@ -35,19 +35,19 @@
"@fontsource/montserrat": "4.5.13", "@fontsource/montserrat": "4.5.13",
"@fontsource/roboto": "4.5.8", "@fontsource/roboto": "4.5.8",
"@heroicons/react": "1.0.6", "@heroicons/react": "1.0.6",
"@sinclair/typebox": "0.25.13", "@sinclair/typebox": "0.25.20",
"axios": "1.2.1", "axios": "1.2.1",
"clsx": "1.2.1", "clsx": "1.2.1",
"date-and-time": "2.4.1", "date-and-time": "2.4.1",
"emoji-mart": "3.0.1", "emoji-mart": "3.0.1",
"katex": "0.16.4", "katex": "0.16.4",
"next": "13.0.6", "next": "13.1.1",
"next-pwa": "5.6.0", "next-pwa": "5.6.0",
"next-themes": "0.2.1", "next-themes": "0.2.1",
"next-translate": "1.6.0", "next-translate": "1.6.0",
"pretty-bytes": "6.0.0", "pretty-bytes": "6.0.0",
"react": "18.2.0", "react": "18.2.0",
"react-component-form": "3.1.1", "react-component-form": "3.1.2",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-infinite-scroll-component": "6.1.0", "react-infinite-scroll-component": "6.1.0",
"react-markdown": "8.0.4", "react-markdown": "8.0.4",
@ -60,52 +60,54 @@
"remark-breaks": "3.0.2", "remark-breaks": "3.0.2",
"remark-gfm": "3.0.1", "remark-gfm": "3.0.1",
"remark-math": "5.1.1", "remark-math": "5.1.1",
"sharp": "0.31.2", "sharp": "0.31.3",
"socket.io-client": "4.5.4", "socket.io-client": "4.5.4",
"unified": "10.1.2", "unified": "10.1.2",
"unist-util-visit": "4.1.1", "unist-util-visit": "4.1.1",
"universal-cookie": "4.0.4" "universal-cookie": "4.0.4"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "17.3.0", "@commitlint/cli": "17.4.1",
"@commitlint/config-conventional": "17.3.0", "@commitlint/config-conventional": "17.4.0",
"@lhci/cli": "0.10.0", "@lhci/cli": "0.10.0",
"@saithodev/semantic-release-backmerge": "2.1.2", "@saithodev/semantic-release-backmerge": "2.1.2",
"@semantic-release/git": "10.0.1", "@semantic-release/git": "10.0.1",
"@tsconfig/strictest": "1.0.2",
"@types/emoji-mart": "3.0.9", "@types/emoji-mart": "3.0.9",
"@types/hast": "2.3.4", "@types/hast": "2.3.4",
"@types/katex": "0.14.0", "@types/katex": "0.16.0",
"@types/node": "18.11.14", "@types/node": "18.11.18",
"@types/react": "18.0.26", "@types/react": "18.0.26",
"@types/react-responsive": "8.0.5", "@types/react-responsive": "8.0.5",
"@types/react-syntax-highlighter": "15.5.5", "@types/react-syntax-highlighter": "15.5.6",
"@types/unist": "2.0.6", "@types/unist": "2.0.6",
"@typescript-eslint/eslint-plugin": "5.46.1", "@typescript-eslint/eslint-plugin": "5.48.1",
"@typescript-eslint/parser": "5.46.1", "@typescript-eslint/parser": "5.48.1",
"autoprefixer": "10.4.13", "autoprefixer": "10.4.13",
"cypress": "12.1.0", "cypress": "12.3.0",
"editorconfig-checker": "4.0.2", "editorconfig-checker": "4.0.2",
"eslint": "8.29.0", "eslint": "8.31.0",
"eslint-config-conventions": "6.0.0", "eslint-config-conventions": "6.0.0",
"eslint-config-next": "13.0.6", "eslint-config-next": "13.1.1",
"eslint-config-prettier": "8.5.0", "eslint-config-prettier": "8.6.0",
"eslint-plugin-import": "2.26.0", "eslint-plugin-import": "2.26.0",
"eslint-plugin-prettier": "4.2.1", "eslint-plugin-prettier": "4.2.1",
"eslint-plugin-promise": "6.1.1", "eslint-plugin-promise": "6.1.1",
"eslint-plugin-unicorn": "45.0.2", "eslint-plugin-unicorn": "45.0.2",
"html-w3c-validator": "1.2.1", "html-w3c-validator": "1.2.2",
"husky": "8.0.2", "husky": "8.0.3",
"lint-staged": "13.1.0", "lint-staged": "13.1.0",
"markdownlint-cli2": "0.5.1", "markdownlint-cli2": "0.6.0",
"markdownlint-rule-relative-links": "1.1.1",
"mockttp": "2.7.0", "mockttp": "2.7.0",
"plop": "3.1.1", "plop": "3.1.1",
"postcss": "8.4.20", "postcss": "8.4.21",
"prettier": "2.8.1", "prettier": "2.8.2",
"prettier-plugin-tailwindcss": "0.2.1", "prettier-plugin-tailwindcss": "0.2.1",
"semantic-release": "19.0.5", "semantic-release": "19.0.5",
"start-server-and-test": "1.15.2", "start-server-and-test": "1.15.2",
"tailwindcss": "3.2.4", "tailwindcss": "3.2.4",
"typescript": "4.9.4", "typescript": "4.9.4",
"vercel": "28.8.0" "vercel": "28.11.0"
} }
} }

View File

@ -62,8 +62,8 @@ const ChannelPage: NextPage<ChannelPageProps> = (props) => {
export const getServerSideProps = authenticationFromServerSide({ export const getServerSideProps = authenticationFromServerSide({
shouldBeAuthenticated: true, shouldBeAuthenticated: true,
fetchData: async (context, api) => { fetchData: async (context, api) => {
const channelId = Number(context?.params?.channelId) const channelId = Number(context?.params?.['channelId'])
const guildId = Number(context?.params?.guildId) const guildId = Number(context?.params?.['guildId'])
if (isNaN(channelId) || isNaN(guildId)) { if (isNaN(channelId) || isNaN(guildId)) {
return { return {
notFound: true notFound: true

View File

@ -57,8 +57,8 @@ const ChannelSettingsPage: NextPage<ChannelSettingsPageProps> = (props) => {
export const getServerSideProps = authenticationFromServerSide({ export const getServerSideProps = authenticationFromServerSide({
shouldBeAuthenticated: true, shouldBeAuthenticated: true,
fetchData: async (context, api) => { fetchData: async (context, api) => {
const channelId = Number(context?.params?.channelId) const channelId = Number(context?.params?.['channelId'])
const guildId = Number(context?.params?.guildId) const guildId = Number(context?.params?.['guildId'])
if (isNaN(channelId) || isNaN(guildId)) { if (isNaN(channelId) || isNaN(guildId)) {
return { return {
notFound: true notFound: true

View File

@ -44,7 +44,7 @@ const CreateChannelPage: NextPage<CreateChannelPageProps> = (props) => {
export const getServerSideProps = authenticationFromServerSide({ export const getServerSideProps = authenticationFromServerSide({
shouldBeAuthenticated: true, shouldBeAuthenticated: true,
fetchData: async (context, api) => { fetchData: async (context, api) => {
const guildId = Number(context?.params?.guildId) const guildId = Number(context?.params?.['guildId'])
if (isNaN(guildId)) { if (isNaN(guildId)) {
return { return {
notFound: true notFound: true

View File

@ -41,7 +41,7 @@ const GuildSettingsPage: NextPage<GuildSettingsPageProps> = (props) => {
export const getServerSideProps = authenticationFromServerSide({ export const getServerSideProps = authenticationFromServerSide({
shouldBeAuthenticated: true, shouldBeAuthenticated: true,
fetchData: async (context, api) => { fetchData: async (context, api) => {
const guildId = Number(context?.params?.guildId) const guildId = Number(context?.params?.['guildId'])
if (isNaN(guildId)) { if (isNaN(guildId)) {
return { return {
notFound: true notFound: true

View File

@ -35,7 +35,7 @@ const UserProfilePage: NextPage<UserProfilePageProps> = (props) => {
export const getServerSideProps = authenticationFromServerSide({ export const getServerSideProps = authenticationFromServerSide({
shouldBeAuthenticated: true, shouldBeAuthenticated: true,
fetchData: async (context, api) => { fetchData: async (context, api) => {
const userId = Number(context?.params?.userId) const userId = Number(context?.params?.['userId'])
if (isNaN(userId)) { if (isNaN(userId)) {
return { return {
notFound: true notFound: true

View File

@ -35,7 +35,7 @@ const ResetPassword: NextPage<FooterProps> = (props) => {
try { try {
await api.put(`/users/reset-password`, { await api.put(`/users/reset-password`, {
...formData, ...formData,
temporaryToken: router.query.temporaryToken temporaryToken: router.query['temporaryToken']
}) })
await router.push('/authentication/signin') await router.push('/authentication/signin')
return null return null

View File

@ -1,12 +1,12 @@
import axios from 'axios' import axios from 'axios'
export const API_VERSION = '1.2.3' export const API_VERSION = '1.2.4'
export const API_DEFAULT_PORT = 8080 export const API_DEFAULT_PORT = 8080
export const API_URL = export const API_URL =
process.env.NEXT_PUBLIC_API_URL != null process.env['NEXT_PUBLIC_API_URL'] != null
? process.env.NEXT_PUBLIC_API_URL ? process.env['NEXT_PUBLIC_API_URL']
: `http://127.0.0.1:${API_DEFAULT_PORT}` : `http://127.0.0.1:${API_DEFAULT_PORT}`
export const api = axios.create({ export const api = axios.create({

View File

@ -59,7 +59,9 @@ export class Authentication {
this.setAccessToken(accessToken) this.setAccessToken(accessToken)
} }
config.headers = config.headers == null ? {} : config.headers config.headers = config.headers == null ? {} : config.headers
config.headers.Authorization = `${this.tokens.type} ${this.tokens.accessToken}` config.headers[
'Authorization'
] = `${this.tokens.type} ${this.tokens.accessToken}`
return config return config
}, },
async (error) => { async (error) => {
@ -96,7 +98,7 @@ export class Authentication {
this.accessTokenAge = Date.now() this.accessTokenAge = Date.now()
const token = `${this.tokens.type} ${this.tokens.accessToken}` const token = `${this.tokens.type} ${this.tokens.accessToken}`
if (typeof this?.socket?.auth !== 'function' && this.socket != null) { if (typeof this?.socket?.auth !== 'function' && this.socket != null) {
this.socket.auth.token = token this.socket.auth['token'] = token
} }
} }

View File

@ -1,23 +1,20 @@
{ {
"extends": "@tsconfig/strictest/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"target": "ESNext", "target": "ESNext",
"module": "ESNext", "module": "ESNext",
"moduleResolution": "node", "moduleResolution": "node",
"allowJs": true, "allowJs": true,
"checkJs": true,
"jsx": "preserve", "jsx": "preserve",
"sourceMap": true, "sourceMap": true,
"removeComments": true, "removeComments": true,
"noEmit": true, "noEmit": true,
"strict": true,
"types": ["cypress"], "types": ["cypress"],
"esModuleInterop": true, "lib": ["dom", "dom.iterable", "ESNext"],
"forceConsistentCasingInFileNames": true,
"lib": ["dom", "dom.iterable", "esnext"],
"skipLibCheck": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"incremental": true "incremental": true,
"exactOptionalPropertyTypes": false
}, },
"exclude": ["dist", ".next", "out", "next.config.js"], "exclude": ["dist", ".next", "out", "next.config.js"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"] "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]