forked from adam/discord-bot-shtik
slightly more generic Patch function for API
Some checks failed
gitea/vassago/pipeline/head There was a failure building this commit
Some checks failed
gitea/vassago/pipeline/head There was a failure building this commit
untested. you know, since... offline ;)
This commit is contained in:
parent
ab16600463
commit
5eeec24069
@ -23,7 +23,7 @@
|
||||
<tr>
|
||||
<th scope="row">Lewdness Filter Level</th>
|
||||
<td>
|
||||
<select name="LewdnessFilterLevel" id="LewdnessFilterLevel" onchange="patchModel(jsonifyChannel())">
|
||||
<select name="LewdnessFilterLevel" id="LewdnessFilterLevel" onchange="patchModel(jsonifyChannel(), '/api/Channels/')">
|
||||
<!option value="" @(ThisChannel.LewdnessFilterLevel == null ? "selected" : "")>⤵ inherited - @Enumerations.GetDescription(IfInheritedLewdnessFilterLevel)</!option>
|
||||
@foreach (Enumerations.LewdnessFilterLevel enumVal in
|
||||
Enum.GetValues(typeof(Enumerations.LewdnessFilterLevel)))
|
||||
@ -53,7 +53,7 @@
|
||||
<tr>
|
||||
<th scope="row">Meanness Filter Level</th>
|
||||
<td>
|
||||
<select name="MeannessFilterLevel" id="MeannessFilterLevel" onchange="patchModel(jsonifyChannel())">
|
||||
<select name="MeannessFilterLevel" id="MeannessFilterLevel" onchange="patchModel(jsonifyChannel(), '/api/Channels/')">
|
||||
<!option value="" @(ThisChannel.MeannessFilterLevel == null ? "selected" : "")>⤵ inherited - @Enumerations.GetDescription(IfInheritedMeannessFilterLevel)</!option>
|
||||
@foreach (Enumerations.MeannessFilterLevel enumVal in
|
||||
Enum.GetValues(typeof(Enumerations.MeannessFilterLevel)))
|
||||
|
@ -7,7 +7,10 @@ function testfunct(caller){
|
||||
console.log("[gibberish]");
|
||||
console.log(caller);
|
||||
}
|
||||
function patchModel(model)
|
||||
//todo: figure out what the URL actually needs to be, rather than assuming you get a whole-ass server to yourself.
|
||||
//you selfish fuck... What are you, fox?
|
||||
//as it stands, you want something like /api/Channels/, trailing slash intentional
|
||||
function patchModel(model, apiUrl)
|
||||
{
|
||||
//structure the model your (dang) self into a nice object
|
||||
console.log(model);
|
||||
@ -16,15 +19,12 @@ function patchModel(model)
|
||||
var components = window.location.pathname.split('/');
|
||||
if(components[2] !== "Details")
|
||||
{
|
||||
console.log("wtf are you doing? " + components[2] + " is something other than Details")
|
||||
console.log("wtf are you doing? " + components[2] + " is something other than Details");
|
||||
//add different endpoings here, if you like
|
||||
}
|
||||
var type=components[1];
|
||||
var id=components[3];
|
||||
|
||||
//todo: figure out what the URL actually needs to be, rather than assuming you get a whole-ass server to yourself.
|
||||
//you selfish fuck. What are you, fox?
|
||||
var apiUrl = "/api/Channels/"
|
||||
|
||||
console.log("dexter impression: I am now ready to post the following content:");
|
||||
console.log(JSON.stringify(model));
|
||||
fetch(apiUrl, {
|
||||
|
Loading…
Reference in New Issue
Block a user