Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

fix: cyptic message when no password is set #183

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@emotion/cache": "11.10.8",
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@graasp/query-client": "1.4.0",
"@graasp/query-client": "github:graasp/graasp-query-client#prettier-imports",
"@graasp/sdk": "1.2.0",
"@graasp/translations": "1.18.0",
"@graasp/ui": "3.3.0",
Expand Down Expand Up @@ -41,6 +41,7 @@
"build": "vite build",
"build:dev": "vite build --mode development",
"preview": "vite preview",
"preview:dev": "vite preview --mode development",
"lint": "eslint .",
"pre-commit": "yarn prettier:check && yarn lint",
"prettier:check": "prettier --check {src,cypress}/**/*.{js,ts,tsx}",
Expand Down
24 changes: 14 additions & 10 deletions src/config/notifier.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { AxiosError } from 'axios';
import { StatusCodes } from 'http-status-codes';
import { toast } from 'react-toastify';

import { routines } from '@graasp/query-client';
import { Notifier, routines } from '@graasp/query-client';
import { FAILURE_MESSAGES } from '@graasp/translations';

import { SHOW_NOTIFICATIONS } from './env';
import i18n from './i18n';
Expand All @@ -12,13 +15,7 @@ const {
signInWithPasswordRoutine,
} = routines;

const notifier = (args: {
type: string;
payload?: {
error?: Error;
message?: string;
};
}) => {
const notifier: Notifier = (args) => {
const { type, payload } = args;

if (!SHOW_NOTIFICATIONS) {
Expand All @@ -30,9 +27,16 @@ const notifier = (args: {
switch (type) {
case signInRoutine.FAILURE:
case signUpRoutine.FAILURE:
case signInWithPasswordRoutine.FAILURE:
case signInWithPasswordRoutine.FAILURE: {
if (
payload.error instanceof AxiosError &&
payload.error.response?.data.statusCode === StatusCodes.NOT_ACCEPTABLE
)
message = FAILURE_MESSAGES.MEMBER_WITHOUT_PASSWORD;
spaenleh marked this conversation as resolved.
Show resolved Hide resolved
break;
}
case getInvitationRoutine.FAILURE: {
message = payload?.error?.message ?? 'An unexpected error occured';
message = payload?.error?.message ?? FAILURE_MESSAGES.UNEXPECTED_ERROR;
break;
}
case signInRoutine.SUCCESS:
Expand Down
5 changes: 4 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const config = ({ mode }: { mode: string }): UserConfigExport => {
ignored: ['**/coverage/**'],
},
},
preview: {
port: parseInt(process.env.VITE_PORT || '3001', 10),
},
build: {
outDir: 'build',
},
Expand All @@ -35,7 +38,7 @@ const config = ({ mode }: { mode: string }): UserConfigExport => {
requireEnv: false,
checkProd: true,
}),
...(mode === 'dev'
...(mode === 'development'
? [
visualizer({
template: 'treemap', // or sunburst
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3118,9 +3118,9 @@ __metadata:
languageName: node
linkType: hard

"@graasp/query-client@npm:1.4.0":
"@graasp/query-client@github:graasp/graasp-query-client#prettier-imports":
version: 1.4.0
resolution: "@graasp/query-client@npm:1.4.0"
resolution: "@graasp/query-client@https://github.com/graasp/graasp-query-client.git#commit=6cd3c1610a489d303f9ff48be696df3383f477df"
dependencies:
"@graasp/sdk": 1.2.0
"@graasp/translations": 1.18.1
Expand All @@ -3133,7 +3133,7 @@ __metadata:
uuid: 9.0.0
peerDependencies:
react: ^17.0.0
checksum: d5581682e607a3275c05ee351987afe490086c06ef078d50aa8c6e2b4662844f9ae722ec925f3aa9bd91c1a68da8b0dea1c6293d263fbed23939156dfe60f90f
checksum: 9558292925c166ea3fc6737c3976350472066644dc077f1bcc9410e87a51d534c8b94e79593849f69a9068655f43c7f73e1fbc32626de4bc9acc2777822a35bb
languageName: node
linkType: hard

Expand Down Expand Up @@ -8608,7 +8608,7 @@ __metadata:
"@emotion/cache": 11.10.8
"@emotion/react": 11.11.1
"@emotion/styled": 11.11.0
"@graasp/query-client": 1.4.0
"@graasp/query-client": "github:graasp/graasp-query-client#prettier-imports"
"@graasp/sdk": 1.2.0
"@graasp/translations": 1.18.0
"@graasp/ui": 3.3.0
Expand Down