Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sign): define BaseUrl and modify style #29

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion components/Profile/Edit/Edit.styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const ContentWrapper = styled.div`
margin: 0 auto;
width: 672px;
@media (max-width: 767px) {
width: 80%;
width: 100%;
.title {
text-overflow: ellipsis;
width: 100%;
Expand Down
1 change: 1 addition & 0 deletions components/Profile/UserTabs/UserTabs.styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const StyledPanelText = styled(Box)`
flex-direction: column;
span {
margin-left: 0px;
place-items: start;
}
}
`;
3 changes: 3 additions & 0 deletions components/Profile/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ const Profile = ({
sx={{
position: 'relative',
mb: '10px',
'@media (max-width: 767px)': {
width: '100%',
},
}}
>
<Button
Expand Down
10 changes: 5 additions & 5 deletions constants/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ export const NAV_LINK = [
link: '/search',
target: '_self',
},
// {
// name: '找夥伴',
// link: '/partner',
// target: '_self',
// },
{
name: '找夥伴',
link: '/partner',
target: '_self',
},
{
name: '找活動',
link: '/activities',
Expand Down
2 changes: 2 additions & 0 deletions constants/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const BASE_URL =
process.env.NEXT_PUBLIC_API_URL || 'https://daodao-server.vercel.app';
11 changes: 2 additions & 9 deletions pages/login/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { LazyLoadImage } from 'react-lazy-load-image-component';
import SEOConfig from '@/shared/components/SEO';
import Navigation from '@/shared/components/Navigation_v2';
import Footer from '@/shared/components/Footer_v2';
import { BASE_URL } from '@/constants/common';
// import sendDataToChromeExtension from '../../utils/sendDataToChromeExtension';

const HomePageWrapper = styled.div`
Expand Down Expand Up @@ -37,10 +38,7 @@ const ContentWrapper = styled.div`
`;

const LoginPage = () => {
const BASEURL = `${
process.env.NEXT_PUBLIC_API_URL || 'https://daodao-server.onrender.com'
}`;
const LOGINPATH = `${BASEURL}/auth/google`;
const LOGINPATH = `${BASE_URL}/auth/google`;
const router = useRouter();

const SEOData = useMemo(
Expand All @@ -57,11 +55,6 @@ const LoginPage = () => {
[router?.asPath],
);

const onLogin = () => {
// toast.success(`歡迎登入! ${displayName}`);
window.open('https://daodao-server.onrender.com/auth/google', '_target');
};

return (
<HomePageWrapper>
<Script src="https://meet.jit.si/external_api.js" />
Expand Down
10 changes: 8 additions & 2 deletions pages/profile/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import styled from '@emotion/styled';
import { useRouter } from 'next/router';
import PropTypes from 'prop-types';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import Typography from '@mui/material/Typography';
Expand Down Expand Up @@ -65,6 +63,11 @@ const ProfilePage = () => {
display: 'flex',
justifyContent: 'center',
marginTop: '60px',
'@media (max-width: 767px)': {
flexDirection: 'column',
marginTop: '0',
padding: '16px',
},
}}
>
<Box
Expand All @@ -75,6 +78,9 @@ const ProfilePage = () => {
borderRadius: '8px',
margin: '26px 40px 0 0',
padding: '8px',
'@media (max-width: 767px)': {
width: '100%',
},
}}
>
<Tabs
Expand Down
8 changes: 3 additions & 5 deletions redux/sagas/partnersSaga.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { put, takeEvery } from 'redux-saga/effects';

const BASEURL = 'https://daodao-server.onrender.com';
import { BASE_URL } from '@/constants/common';

function* fetchPartnersResource(action) {
const { pageSize = 10, page = 1, ...rest } = action.payload;
Expand Down Expand Up @@ -51,9 +50,8 @@ function* fetchPartnerById(action) {

function* sendEmailToPartner(action) {
try {
const baseUrl = process.env.NEXT_PUBLIC_API_URL || BASEURL;
const URL = `${baseUrl}/email`;
const result = yield fetch(URL, {
const URL = `${BASE_URL}/email`;
yield fetch(URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
12 changes: 4 additions & 8 deletions redux/sagas/user/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { put, all, take, takeEvery, select, call } from 'redux-saga/effects';
import * as localforage from 'localforage';
import firebase from '../../../utils/firebase';
import { BASE_URL } from '@/constants/common';

function* checkUserStatus() {
try {
Expand Down Expand Up @@ -38,8 +39,7 @@ function* userLogin() {

function* fetchAllUsers() {
try {
const URL =
process.env.NEXT_PUBLIC_API_URL || 'https://daodao-server.onrender.com';
const URL = BASE_URL;
const result = yield call(URL);
yield put({ type: 'FETCH_ALL_USER_SUCCESS', payload: result });
} catch (error) {
Expand All @@ -50,9 +50,7 @@ function* fetchAllUsers() {
function* updateUserProfile(action) {
const { user } = action.payload;
try {
const baseUri =
process.env.NEXT_PUBLIC_API_URL || 'https://daodao-server.onrender.com';
const URL = `${baseUri}/user/${user.id}`;
const URL = `${BASE_URL}/user/${user.id}`;

const result = yield fetch(URL, {
method: 'PUT',
Expand All @@ -73,9 +71,7 @@ function* updateUserProfile(action) {
function* fetchUserById(action) {
const { id } = action.payload;
try {
const baseUrl =
process.env.NEXT_PUBLIC_API_URL || 'https://daodao-server.onrender.com';
const URL = `${baseUrl}/user/${id}`;
const URL = `${BASE_URL}/user/${id}`;
const result = yield fetch(URL).then((res) => res.json());
yield put({
type: 'FETCH_USER_BY_ID_SUCCESS',
Expand Down
Loading