1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Send password in request ctor directly

This commit is contained in:
Dean Herbert 2021-07-13 14:27:07 +09:00
parent 35b5f0462c
commit 125bd36ab1
2 changed files with 6 additions and 6 deletions

View File

@ -10,19 +10,22 @@ namespace osu.Game.Online.Rooms
public class JoinRoomRequest : APIRequest
{
private readonly Room room;
private readonly string password;
public JoinRoomRequest(Room room)
public JoinRoomRequest(Room room, string password)
{
this.room = room;
this.password = password;
}
protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
req.Method = HttpMethod.Put;
req.AddParameter("password", password);
return req;
}
protected override string Target => $"rooms/{room.RoomID.Value}/users/{User.Id}?password={room.Password.Value}";
protected override string Target => $"rooms/{room.RoomID.Value}/users/{User.Id}";
}
}

View File

@ -86,11 +86,8 @@ namespace osu.Game.Screens.OnlinePlay.Components
public virtual void JoinRoom(Room room, string password = null, Action<Room> onSuccess = null, Action<string> onError = null)
{
// todo: send into JoinRoomRequest directly?
room.Password.Value = password;
currentJoinRoomRequest?.Cancel();
currentJoinRoomRequest = new JoinRoomRequest(room);
currentJoinRoomRequest = new JoinRoomRequest(room, password);
currentJoinRoomRequest.Success += () =>
{