Redux -> Fixes

feature/2_forms
TBS093A 2021-02-17 10:00:09 +01:00
parent cd746fbb6b
commit 7078b4f4f2
4 changed files with 28 additions and 9 deletions

View File

@ -20,7 +20,7 @@ const fetchGetAllModels = createAsyncThunk(
* param id: model id * param id: model id
*/ */
const fetchGetOneModelAndDownload = createAsyncThunk( const fetchGetOneModelAndDownload = createAsyncThunk(
'model/fetchGetAllModels', 'model/fetchGetOneModelAndDownload',
async ( async (
body, body,
thunkAPI thunkAPI
@ -40,7 +40,7 @@ const fetchGetOneModelAndDownload = createAsyncThunk(
* param user_id: user id * param user_id: user id
*/ */
const fetchUploadModel = createAsyncThunk( const fetchUploadModel = createAsyncThunk(
'model/fetchGetAllModels', 'model/fetchUploadModel',
async ( async (
body, body,
thunkAPI thunkAPI

View File

@ -5,7 +5,7 @@ let endpoint = '/render/'
const fetchGetAllRenders = createAsyncThunk( const fetchGetAllRenders = createAsyncThunk(
'model/fetchGetAllModels', 'render/fetchGetAllRenders',
async ( async (
token, token,
thunkAPI thunkAPI
@ -20,7 +20,7 @@ const fetchGetAllRenders = createAsyncThunk(
* param id: render id * param id: render id
*/ */
const fetchGetOneRenderAndDownload = createAsyncThunk( const fetchGetOneRenderAndDownload = createAsyncThunk(
'model/fetchGetAllModels', 'render/fetchGetOneRenderAndDownload',
async ( async (
body, body,
thunkAPI thunkAPI

View File

@ -9,7 +9,7 @@ let endpoint = '/user/auth'
* param password: password string * param password: password string
*/ */
const fetchLogin = createAsyncThunk( const fetchLogin = createAsyncThunk(
'model/fetchGetAllModels', 'user/auth/fetchLogin',
async ( async (
body, body,
thunkAPI thunkAPI
@ -22,6 +22,25 @@ const fetchLogin = createAsyncThunk(
} }
) )
/**
* @param body:
* param token: user token
*/
const fetchLogout = createAsyncThunk(
'user/auth/fetchLogout',
async (
token,
thunkAPI
) => {
return await abstractService._delete(
endpoint,
'',
token
)
}
)
export default { export default {
fetchLogin fetchLogin,
fetchLogout
} }

View File

@ -1,11 +1,11 @@
import { createAsyncThunk } from '@reduxjs/toolkit' import { createAsyncThunk } from '@reduxjs/toolkit'
import abstractService from './abstractService' import abstractService from './abstractService'
let endpoint = '/model/' let endpoint = '/user/'
const fetchGetAllUsers = createAsyncThunk( const fetchGetAllUsers = createAsyncThunk(
'model/fetchGetAllModels', 'user/fetchGetAllUsers',
async ( async (
token, token,
thunkAPI thunkAPI
@ -24,7 +24,7 @@ const fetchGetAllUsers = createAsyncThunk(
* param email: email string * param email: email string
*/ */
const fetchRegister = createAsyncThunk( const fetchRegister = createAsyncThunk(
'model/fetchGetAllModels', 'user/fetchRegister',
async ( async (
body, body,
thunkAPI thunkAPI