-
Notifications
You must be signed in to change notification settings - Fork 4
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 #54 from fdhhhdjd/release-#2-frontend
Release #2 frontend
- Loading branch information
Showing
36 changed files
with
967 additions
and
49 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 |
---|---|---|
|
@@ -73,5 +73,6 @@ | |
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
}, | ||
"proxy": "http://localhost:5000" | ||
} |
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,15 @@ | ||
const API_USERS = { | ||
//* Login | ||
LOGIN_EMAIL_PHONE: "/api/user/login", | ||
LOGIN_PHONE_OTP: "/api/user/login/mobile", | ||
LOGIN_GOOGLE: "/api/user/login/google", | ||
LOGIN_FACEBOOK: "/api/user/login/facebook", | ||
|
||
//* New Accept Token | ||
NEW_ACCESS_TOKEN: "api/user/new/accessToken", | ||
//* Logout | ||
LOGOUT_USERS: "/api/user/logout", | ||
//* Profile | ||
GET_PROFILE_USER: "/api/user/profile", | ||
}; | ||
export default API_USERS; |
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
117 changes: 117 additions & 0 deletions
117
frontend/src/v1/redux/authentication_slice/Api_Redux_Thunk.js
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,117 @@ | ||
import { createAsyncThunk } from "@reduxjs/toolkit"; | ||
import axios from "axios"; | ||
import API_USERS from "../../configs/Apis/User_Api/Api_Users"; | ||
export const Login_Email_Phone_Initial = createAsyncThunk( | ||
"Users/Login/Email/Phone", | ||
async ({ email, password, token }, { rejectWithValue }) => { | ||
try { | ||
const response = await axios.post(`${API_USERS.LOGIN_EMAIL_PHONE}`, { | ||
email_phone: email, | ||
password, | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); | ||
export const Login_Phone_Otp_Initial = createAsyncThunk( | ||
"Users/Login/Mobile/Phone", | ||
async (phone_number, { rejectWithValue }) => { | ||
try { | ||
const response = await axios.post(`${API_USERS.LOGIN_PHONE_OTP}`, { | ||
phone_number, | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); | ||
export const Login_Google_Initial = createAsyncThunk( | ||
"Users/Login/Google", | ||
async (response_google, { rejectWithValue }) => { | ||
try { | ||
const response = await axios.post(`${API_USERS.LOGIN_GOOGLE}`, { | ||
tokenId: response_google.tokenId, | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); | ||
export const Login_Facebook_Initial = createAsyncThunk( | ||
"Users/Login/Facebook", | ||
async (response_facebook, { rejectWithValue }) => { | ||
try { | ||
const response = await axios.post(`${API_USERS.LOGIN_FACEBOOK}`, { | ||
accessToken: response_facebook.accessToken, | ||
userID: response_facebook.userID, | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); | ||
export const New_Accept_Token_Initial = createAsyncThunk( | ||
"Users/New/Accept/Token", | ||
async (token, { rejectWithValue }) => { | ||
try { | ||
const response = await axios.get(`${API_USERS.NEW_ACCESS_TOKEN}`); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); | ||
export const Logout_Users_Initial = createAsyncThunk( | ||
"Users/Logout", | ||
async (token, { rejectWithValue }) => { | ||
const config = { | ||
headers: { Authorization: `Bearer Token ${token}` }, | ||
}; | ||
try { | ||
const response = await axios.get(`${API_USERS.LOGOUT_USERS}`, config); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); | ||
export const Profile_Users_Initial = createAsyncThunk( | ||
"Users/Profile", | ||
async ({ token }, { rejectWithValue }) => { | ||
const config = { | ||
headers: { Authorization: `Bearer ${token}` }, | ||
}; | ||
try { | ||
const response = await axios.get(`${API_USERS.GET_PROFILE_USER}`, config); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); |
109 changes: 103 additions & 6 deletions
109
frontend/src/v1/redux/authentication_slice/AuthenticationSlice.js
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,20 +1,117 @@ | ||
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"; | ||
import axios from "axios"; | ||
import { createSlice } from "@reduxjs/toolkit"; | ||
import { | ||
Login_Email_Phone_Initial, | ||
Login_Facebook_Initial, | ||
Login_Google_Initial, | ||
Login_Phone_Otp_Initial, | ||
Logout_Users_Initial, | ||
New_Accept_Token_Initial, | ||
Profile_Users_Initial, | ||
} from "../authentication_slice/Api_Redux_Thunk"; | ||
const initialState = { | ||
loading: false, | ||
error: null, | ||
auth: [], | ||
accessToken: null, | ||
profile: null, | ||
}; | ||
const Authentication = createSlice({ | ||
name: "auth", | ||
name: "Authentication_Users", | ||
initialState, | ||
reducers: { | ||
reset: (state) => { | ||
reset_auth: (state) => { | ||
state.auth = []; | ||
state.accessToken = null; | ||
state.profile = null; | ||
}, | ||
}, | ||
extraReducers: { | ||
//* Login Email_Phone have Password | ||
[Login_Email_Phone_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Login_Email_Phone_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.auth = action.payload; | ||
}, | ||
[Login_Email_Phone_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
//* Login Phone OTP | ||
[Login_Phone_Otp_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Login_Phone_Otp_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.auth = action.payload; | ||
}, | ||
[Login_Phone_Otp_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
//* Login Google | ||
[Login_Google_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Login_Google_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.auth = action.payload; | ||
}, | ||
[Login_Google_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
//* Login Facebook | ||
[Login_Facebook_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Login_Facebook_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.auth = action.payload; | ||
}, | ||
[Login_Facebook_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
//* Logout Users | ||
[Logout_Users_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Logout_Users_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.auth = action.payload; | ||
}, | ||
[Logout_Users_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
//* New Accept Token | ||
[New_Accept_Token_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[New_Accept_Token_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.accessToken = action.payload.element.accessToken; | ||
}, | ||
[New_Accept_Token_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
//* New Accept Token | ||
[Profile_Users_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Profile_Users_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.profile = action.payload; | ||
}, | ||
[Profile_Users_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
}, | ||
extraReducers: {}, | ||
}); | ||
const AuthenticationSlice = Authentication.reducer; | ||
export const { reset } = Authentication.actions; | ||
export const { reset_auth } = Authentication.actions; | ||
export default AuthenticationSlice; |
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
Oops, something went wrong.
455477b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
full-stack-shop-shoes – ./
full-stack-shop-shoes.vercel.app
full-stack-shop-shoes-git-main-fdhhhdjd.vercel.app
full-stack-shop-shoes-fdhhhdjd.vercel.app
shopshoes.cf
455477b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
serversendemailshopshoes – ./server_send_email
full-stack-shop-shoes-bootstrap.vercel.app
serversendemailshopshoes-git-main-fdhhhdjd.vercel.app
serversendemailshopshoes-fdhhhdjd.vercel.app