The parties choose their candidates. The consent of the people have nothing to do with it. It’s designed to keep the masses from falling for a populist lunatic.
Which makes the whole voting process a sham and exercise in futility. There must be some mitigation or understandable link between the voters, the delegates/electoral college, and the elected candidate that makes the voting process a valid democratic process in the choosing of a candidate.