-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor transfer backend to match others * wip commit - backend should be done at this point regarding the actual action of transfering ownership * add padding to allow more links on line * add transfer btn to view * Add route * make a post a get - simplicity * get the user id by querying the membership id - im assuming this returns the user * remove relic from manage page * lint * finalize this feature * add fcaps suggested changes
- Loading branch information
Showing
7 changed files
with
107 additions
and
188 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 |
---|---|---|
|
@@ -69,6 +69,7 @@ | |
|
||
.action-link | ||
color: #ec9d36 | ||
margin-right: 2em | ||
&:link | ||
color: #ec9d36 | ||
&:visited | ||
|
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 was deleted.
Oops, something went wrong.
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,35 @@ | ||
const { JavaApiError } = require('../../../services/ApiErrors') | ||
|
||
exports = module.exports = [ | ||
async (req, res) => { | ||
if (!req.requestContainer.get('UserService').getUser()?.clan?.id) { | ||
await req.asyncFlash('error', "You don't own a clan") | ||
|
||
return res.redirect('/clans') | ||
} | ||
|
||
const newOwnerId = parseInt(req.params.userId) | ||
try { | ||
await req.requestContainer | ||
.get('ClanManagementService') | ||
.transferOwnership(newOwnerId) | ||
await req.asyncFlash('info', 'Clan ownership transferred') | ||
|
||
return res.redirect( | ||
'/clans/view/' + | ||
req.requestContainer.get('UserService').getUser().clan.id | ||
) | ||
} catch (e) { | ||
let message = e.toString() | ||
if (e instanceof JavaApiError && e.error?.errors) { | ||
message = e.error.errors[0].detail | ||
} | ||
|
||
await req.asyncFlash('error', message) | ||
return res.redirect( | ||
'/clans/view/' + | ||
req.requestContainer.get('UserService').getUser().clan.id | ||
) | ||
} | ||
}, | ||
] |
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