Skip to content

Commit

Permalink
Replace old device id in url
Browse files Browse the repository at this point in the history
  • Loading branch information
kraxarn committed Aug 14, 2021
1 parent 5fd6a60 commit 9ac7120
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/src/spotify/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,16 @@ void api::put(const std::string &url, const nlohmann::json &body,
return;
}

this->set_device(device, [this, url, body, callback]
// Remember old device to replace in new URL
const auto &old_device = settings.general.last_device;

this->set_device(device, [this, url, body, callback, device, old_device]
(const std::string &status)
{
if (status.empty())
{
this->put(url, body, callback);
this->put(lib::strings::replace_all(url, old_device, device.id),
body, callback);
}
});
});
Expand Down

0 comments on commit 9ac7120

Please sign in to comment.