generated from Game-as-a-Service/Gaas-repo-template
-
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.
Co-authored-by: dawnglede <[email protected]> Co-authored-by: Enya <[email protected]>
- Loading branch information
1 parent
a5a166b
commit 049646a
Showing
25 changed files
with
2,318 additions
and
866 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,12 +1,12 @@ | ||
describe('Login Page Test', () => { | ||
it('save user name', () => { | ||
cy.visit('http://localhost:3001/login'); | ||
cy.get('#name').type('Snowman'); | ||
cy.get('.login_button').click(); | ||
cy.url().should('include', '/rooms'); | ||
cy.visit('http://localhost:3001/login') | ||
cy.get('#name').type('Snowman') | ||
cy.get('.login_button').click() | ||
cy.url().should('include', '/rooms') | ||
cy.window().then((win) => { | ||
// 使用 win.localStorage.getItem() 來獲取 localStorage 的值 | ||
expect(win.localStorage.getItem('userName')).to.equal('Snowman'); | ||
}); | ||
expect(win.localStorage.getItem('userName')).to.equal('Snowman') | ||
}) | ||
}) | ||
}) |
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,26 @@ | ||
import axios from 'axios' | ||
|
||
export default (baseUrl: string) => { | ||
const instance = axios.create({ | ||
baseURL: baseUrl | ||
}) | ||
instance.interceptors.response.use( | ||
(res) => { | ||
if (res && res.status === 200) { | ||
return res.data | ||
} | ||
}, | ||
(error) => { | ||
if (error.response) { | ||
switch (error.response.status) { | ||
case 404: | ||
break | ||
default: | ||
console.log(error.message) | ||
} | ||
} | ||
return Promise.reject(error) | ||
} | ||
) | ||
return instance | ||
} |
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,42 @@ | ||
export type CreateRoom = { | ||
createTime: string | ||
status: string | ||
msg: string | ||
rooms: Record<string, UpdatedRooms> | ||
} | ||
|
||
export type UpdatedRooms = { | ||
roomId: string | ||
roomName: string | ||
holderId: string | ||
holderName: string | ||
users: Array<{ | ||
userId: string | ||
userName: string | ||
userImage: string | ||
}> | ||
status: string | ||
totalUsers: number | ||
} | ||
|
||
export type SpecificRoom = { | ||
searchTime: string | ||
status: string | ||
msg: string | ||
rooms: Record<string, TimedRooms> | ||
} | ||
|
||
export type TimedRooms = { | ||
roomId: string | ||
roomName: string | ||
createTime: string | ||
status: string | ||
holderName: string | ||
holderId: string | ||
totalUsers: number | ||
users: Array<{ | ||
userId: string | ||
userName: string | ||
userImage: string | ||
}> | ||
} |
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,28 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const ErrorModal = (props) => { | ||
const { isErrorVisible, onClose, errorText } = props | ||
return ( | ||
<> | ||
{isErrorVisible && ( | ||
<div className='error-modal'> | ||
<div className='error-modal-content'> | ||
<span className='error-text'>{errorText}</span> | ||
<button className='cancel-btn' onClick={onClose}> | ||
Close | ||
</button> | ||
</div> | ||
</div> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
ErrorModal.propTypes = { | ||
isErrorVisible: PropTypes.bool.isRequired, | ||
onClose: PropTypes.func.isRequired, | ||
errorText: PropTypes.node.isRequired | ||
} | ||
|
||
export default ErrorModal |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.