-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/various-quizzes'.
- Loading branch information
Showing
81 changed files
with
988 additions
and
665 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
EMAIL=d.leclerc.pro@gmail.com | ||
DOMAIN=liquors.dleclerc.me | ||
PROXY_URL=http://liquors-quiz-app:8000 | ||
DOMAIN=quiz.dleclerc.me | ||
PROXY_URL=http://quiz-app:8000 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,31 +1,19 @@ | ||
import { createAsyncThunk } from '@reduxjs/toolkit'; | ||
import { VersionData } from '../types/DataTypes'; | ||
import { CallGetVersion } from '../calls/quiz/CallGetVersion'; | ||
import { setVersion } from '../reducers/AppReducer'; | ||
import { ThunkAPI, createServerAction } from './ServerActions'; | ||
|
||
export const fetchVersion = createAsyncThunk( | ||
'app/version', | ||
async (_, { dispatch, rejectWithValue }) => { | ||
try { | ||
const { data } = await new CallGetVersion().execute(); | ||
export const updateVersion = createServerAction<void, void>( | ||
'app/updateVersion', | ||
async (_, { dispatch }: ThunkAPI) => { | ||
const { data } = await new CallGetVersion().execute(); | ||
|
||
if (!data) { | ||
throw new Error('MISSING_DATA'); | ||
} | ||
|
||
const { version } = data as VersionData; | ||
|
||
dispatch(setVersion(version)); | ||
if (!data) { | ||
throw new Error('MISSING_DATA'); | ||
} | ||
|
||
} catch (err: unknown) { | ||
let error = 'UNKNOWN_ERROR'; | ||
|
||
if (err instanceof Error) { | ||
error = err.message; | ||
} | ||
const { version } = data as VersionData; | ||
|
||
console.error(`Could not get app version: ${error}`); | ||
return rejectWithValue(error); | ||
} | ||
} | ||
dispatch(setVersion(version)); | ||
}, | ||
); |
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,45 @@ | ||
import { CallLogIn } from '../calls/auth/CallLogIn'; | ||
import { LoginData, PingData, UserData } from '../types/DataTypes'; | ||
import { CallPing } from '../calls/auth/CallPing'; | ||
import { CallLogOut } from '../calls/auth/CallLogOut'; | ||
import { createServerAction } from './ServerActions'; | ||
|
||
export const login = createServerAction<LoginData, UserData>( | ||
'auth/login', | ||
async (args: LoginData) => { | ||
const { quizId } = args; | ||
const { data } = await new CallLogIn().execute(args); | ||
|
||
if (!data) { | ||
throw new Error('MISSING_DATA'); | ||
} | ||
|
||
const user = data as UserData; | ||
|
||
return { | ||
username: user.username, | ||
isAdmin: user.isAdmin, | ||
quizId, | ||
}; | ||
}, | ||
); | ||
|
||
export const logout = createServerAction<void, void>( | ||
'auth/logout', | ||
async () => { | ||
await new CallLogOut().execute(); | ||
}, | ||
); | ||
|
||
export const ping = createServerAction<void, PingData>( | ||
'auth/ping', | ||
async () => { | ||
const { data } = await new CallPing().execute(); | ||
|
||
if (!data) { | ||
throw new Error('MISSING_DATA'); | ||
} | ||
|
||
return data as PingData; | ||
}, | ||
); |
Oops, something went wrong.